diff options
Diffstat (limited to 'cpp/src/Ice/ConnectionFactory.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index db378242b6a..0fa44c14a95 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -157,173 +157,6 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished() } } -ConnectionIPtr -IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpts, bool hasMore, - Ice::EndpointSelectionType selType, bool& compress) -{ - assert(!endpts.empty()); - - // - // Apply the overrides. - // - vector<EndpointIPtr> endpoints = applyOverrides(endpts); - - // - // Try to find a connection to one of the given endpoints. - // - Ice::ConnectionIPtr connection = findConnection(endpoints, compress); - if(connection) - { - return connection; - } - - IceUtil::UniquePtr<Ice::LocalException> exception; - - // - // If we didn't find a connection with the endpoints, we create the connectors - // for the endpoints. - // - vector<ConnectorInfo> connectors; - for(vector<EndpointIPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) - { - // - // Create connectors for the endpoint. - // - try - { - vector<ConnectorPtr> cons = (*p)->connectors(selType); - assert(!cons.empty()); - for(vector<ConnectorPtr>::const_iterator r = cons.begin(); r != cons.end(); ++r) - { - assert(*r); - connectors.push_back(ConnectorInfo(*r, *p)); - } - } - catch(const Ice::LocalException& ex) - { - exception.reset(ex.ice_clone()); - handleException(ex, hasMore || p != endpoints.end() - 1); - } - } - - if(connectors.empty()) - { - assert(exception.get()); - exception->ice_throw(); - } - - // - // Try to get a connection to one of the connectors. A null result indicates that no - // connection was found and that we should try to establish the connection (and that - // the connectors were added to _pending to prevent other threads from establishing - // the connection). - // - connection = getConnection(connectors, 0, compress); - if(connection) - { - return connection; - } - - // - // Try to establish the connection to the connectors. - // - DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); - const CommunicatorObserverPtr& obsv = _instance->initializationData().observer; - vector<ConnectorInfo>::const_iterator q; - for(q = connectors.begin(); q != connectors.end(); ++q) - { - ObserverPtr observer; - if(obsv) - { - observer = obsv->getConnectionEstablishmentObserver(q->endpoint, q->connector->toString()); - if(observer) - { - observer->attach(); - } - } - - try - { - if(_instance->traceLevels()->network >= 2) - { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "trying to establish " << q->endpoint->protocol() << " connection to " - << q->connector->toString(); - } - connection = createConnection(q->connector->connect(), *q); - connection->start(0); - - if(observer) - { - observer->detach(); - } - - if(defaultsAndOverrides->overrideCompress) - { - compress = defaultsAndOverrides->overrideCompressValue; - } - else - { - compress = q->endpoint->compress(); - } - - connection->activate(); - break; - } - catch(const Ice::CommunicatorDestroyedException& ex) - { - if(observer) - { - observer->failed(ex.ice_name()); - observer->detach(); - } - exception.reset(ex.ice_clone()); - handleConnectionException(*exception.get(), hasMore || q != connectors.end() - 1); - connection = 0; - break; // No need to continue - } - catch(const Ice::LocalException& ex) - { - if(_instance->traceLevels()->network >= 2) - { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "failed to establish " << q->endpoint->protocol() << " connection to " - << q->connector->toString() << "\n" << ex; - } - - if(observer) - { - observer->failed(ex.ice_name()); - observer->detach(); - } - exception.reset(ex.ice_clone()); - handleConnectionException(*exception.get(), hasMore || q != connectors.end() - 1); - connection = 0; - } - } - - // - // Finish creating the connection (this removes the connectors from the _pending - // list and notifies any waiting threads). - // - if(connection) - { - finishGetConnection(connectors, *q, connection, 0); - } - else - { - finishGetConnection(connectors, *exception.get(), 0); - } - - if(!connection) - { - assert(exception.get()); - exception->ice_throw(); - } - - return connection; -} - void IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpts, bool hasMore, Ice::EndpointSelectionType selType, |