diff options
author | Michi Henning <michi@zeroc.com> | 2007-05-04 05:24:44 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-05-04 05:24:44 +0000 |
commit | df88a798fff56373464751cb95f0cb26e585ebc1 (patch) | |
tree | 99a83f212da9ca161a6ec408c895486bf71486d7 /cpp/src/Ice/EndpointFactoryManager.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2181 (diff) | |
download | ice-df88a798fff56373464751cb95f0cb26e585ebc1.tar.bz2 ice-df88a798fff56373464751cb95f0cb26e585ebc1.tar.xz ice-df88a798fff56373464751cb95f0cb26e585ebc1.zip |
Bug 1022.
Diffstat (limited to 'cpp/src/Ice/EndpointFactoryManager.cpp')
-rw-r--r-- | cpp/src/Ice/EndpointFactoryManager.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp index 27c334d0712..f0a4dbb35dc 100644 --- a/cpp/src/Ice/EndpointFactoryManager.cpp +++ b/cpp/src/Ice/EndpointFactoryManager.cpp @@ -98,7 +98,48 @@ IceInternal::EndpointFactoryManager::create(const string& str) const { if(_factories[i]->protocol() == protocol) { +#if 1 return _factories[i]->create(str.substr(end)); +#else + // Code below left in place for debugging. + + EndpointIPtr e = _factories[i]->create(str.substr(end)); + BasicStream bs(_instance.get()); + e->streamWrite(&bs); + bs.i = bs.b.begin(); + short type; + bs.read(type); + EndpointIPtr ue = new IceInternal::UnknownEndpointI(type, &bs); + cerr << "Normal: " << e->toString() << endl; + cerr << "Opaque: " << ue->toString() << endl; + return e; +#endif + } + } + + // + // If the stringified endpoint is opaque, create an unknown endpoint, + // then see whether the type matches one of the known endpoints. + // + if(protocol == "opaque") + { + EndpointIPtr ue = new UnknownEndpointI(str.substr(end)); + for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++) + { + if(_factories[i]->type() == ue->type()) + { + // + // 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()); + ue->streamWrite(&bs); + bs.i = bs.b.begin(); + short type; + bs.read(type); + return _factories[i]->read(&bs); + } } } |