From aa3c4ebfa279188cf689c6ef2318ed573c4fec7b Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Fri, 26 Sep 2014 18:39:28 +0200 Subject: Fixed deadlock in connection binding code (ICE-5693) --- cpp/src/Ice/ConnectionRequestHandler.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'cpp/src/Ice/ConnectionRequestHandler.cpp') diff --git a/cpp/src/Ice/ConnectionRequestHandler.cpp b/cpp/src/Ice/ConnectionRequestHandler.cpp index 4d9d746675d..43dda1b88ed 100644 --- a/cpp/src/Ice/ConnectionRequestHandler.cpp +++ b/cpp/src/Ice/ConnectionRequestHandler.cpp @@ -38,6 +38,40 @@ ConnectionRequestHandler::ConnectionRequestHandler(const ReferencePtr& reference { } +RequestHandlerPtr +ConnectionRequestHandler::connect() +{ + assert(false); // This request handler is only created after connection binding. + return 0; +} + +RequestHandlerPtr +ConnectionRequestHandler::update(const RequestHandlerPtr& previousHandler, const RequestHandlerPtr& newHandler) +{ + assert(previousHandler); + try + { + if(previousHandler.get() == this) + { + return newHandler; + } + else if(previousHandler->getConnection() == _connection) + { + // + // If both request handlers point to the same connection, we also + // update the request handler. See bug ICE-5489 for reasons why + // this can be useful. + // + return newHandler; + } + } + catch(const Ice::Exception&) + { + // Ignore. + } + return this; +} + void ConnectionRequestHandler::prepareBatchRequest(BasicStream* out) { -- cgit v1.2.3