summaryrefslogtreecommitdiff
path: root/cppe/src/TcpTransport/EndpointFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/src/TcpTransport/EndpointFactory.cpp')
-rw-r--r--cppe/src/TcpTransport/EndpointFactory.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/cppe/src/TcpTransport/EndpointFactory.cpp b/cppe/src/TcpTransport/EndpointFactory.cpp
index 0c865dcc887..f95bb72f9d8 100644
--- a/cppe/src/TcpTransport/EndpointFactory.cpp
+++ b/cppe/src/TcpTransport/EndpointFactory.cpp
@@ -11,6 +11,7 @@
#include <IceE/UnknownEndpoint.h>
#include <IceE/LocalException.h>
#include <IceE/BasicStream.h>
+#include <IceE/Instance.h>
#include <TcpTransport/TcpEndpoint.h>
using namespace std;
@@ -54,6 +55,34 @@ IceInternal::EndpointFactory::create(const std::string& str) const
return new TcpEndpoint(_instance, str.substr(end));
}
+ //
+ // If the stringified endpoint is opaque, create an unknown endpoint,
+ // then see whether the type matches one of the known endpoints.
+ //
+ if(protocol == "opaque")
+ {
+ EndpointPtr ue = new UnknownEndpoint(str.substr(end));
+ if(ue->type() == TcpEndpointType)
+ {
+ //
+ // Make a temporary stream, write the opaque endpoint data into the stream,
+ // and ask the factory to read the endpoint data from that stream to create
+ // the actual endpoint.
+ //
+ BasicStream bs(_instance.get(), _instance->messageSizeMax(),
+#ifdef ICEE_HAS_WSTRING
+ _instance->initializationData().stringConverter,
+ _instance->initializationData().wstringConverter
+#endif
+ );
+ ue->streamWrite(&bs);
+ bs.i = bs.b.begin();
+ short type;
+ bs.read(type);
+ return new TcpEndpoint(&bs);
+ }
+ }
+
return 0;
}