summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp48
-rw-r--r--cpp/src/Ice/ConnectionI.cpp12
2 files changed, 24 insertions, 36 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 8b1ee46b544..bc2f19e4ae9 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -300,7 +300,16 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
catch(const LocalException& ex)
{
exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
- connection = 0; // Necessary for the case where validate() fails.
+
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ connection = 0;
+ }
}
TraceLevelsPtr traceLevels = _instance->traceLevels();
@@ -575,8 +584,7 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
connections.swap(_connections);
}
- if(threadPerIncomingConnectionFactory &&
- threadPerIncomingConnectionFactory->getThreadControl() != IceUtil::ThreadControl())
+ if(threadPerIncomingConnectionFactory)
{
threadPerIncomingConnectionFactory->getThreadControl().join();
}
@@ -747,12 +755,6 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
}
catch(const LocalException&)
{
- //
- // Ignore all exceptions while constructing the
- // connection. Warning or error messages for such
- // exceptions are printed directly by the connection
- // object constructor.
- //
return;
}
@@ -771,11 +773,9 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
}
catch(const LocalException&)
{
- //
- // Ignore all exceptions while validating the
- // connection. Warning or error messages for such exceptions
- // are printed directly by the validation code.
- //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ _connections.remove(connection);
return;
}
@@ -858,11 +858,14 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
catch(const LocalException&)
{
//
- // Ignore all exceptions while constructing or validating
- // the connection. Warning or error messages for such
- // exceptions are printed directly by the connection
- // object constructor and validation code.
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
//
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ }
+
return;
}
@@ -903,10 +906,6 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
// Here we ignore any exceptions in close().
}
- _state = StateClosed;
- _acceptor = 0;
- _threadPerIncomingConnectionFactory = 0;
-
__setNoDelete(false);
ex.ice_throw();
}
@@ -1123,11 +1122,6 @@ IceInternal::IncomingConnectionFactory::run()
}
catch(const LocalException&)
{
- //
- // We don't print any errors here, the connection
- // constructor is responsible for printing the
- // error.
- //
return;
}
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index e285345d632..cda13954e68 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -285,9 +285,7 @@ Ice::ConnectionI::isFinished() const
}
if(_transceiver != 0 || _dispatchCount != 0 ||
- (_threadPerConnection &&
- _threadPerConnection->getThreadControl() != IceUtil::ThreadControl() &&
- _threadPerConnection->getThreadControl().isAlive()))
+ (_threadPerConnection && _threadPerConnection->getThreadControl().isAlive()))
{
return false;
}
@@ -298,7 +296,7 @@ Ice::ConnectionI::isFinished() const
_threadPerConnection = 0;
}
- if(threadPerConnection && threadPerConnection->getThreadControl() != IceUtil::ThreadControl())
+ if(threadPerConnection)
{
threadPerConnection->getThreadControl().join();
}
@@ -385,7 +383,7 @@ Ice::ConnectionI::waitUntilFinished()
_threadPerConnection = 0;
}
- if(threadPerConnection && threadPerConnection->getThreadControl() != IceUtil::ThreadControl())
+ if(threadPerConnection)
{
threadPerConnection->getThreadControl().join();
}
@@ -1496,8 +1494,6 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
}
}
- _state = StateClosed;
-
try
{
_transceiver->close();
@@ -1506,8 +1502,6 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
{
// Here we ignore any exceptions in close().
}
- _transceiver = 0;
- _threadPerConnection = 0;
__setNoDelete(false);
ex.ice_throw();