diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-09-08 17:01:10 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-09-08 17:01:10 +0200 |
commit | 0df6f42a702bcc634cd3897fc21e38e05ef26fab (patch) | |
tree | 31ca325166b9d3b7adec37d9e9b7d06a03622b77 /cpp | |
parent | Fixed ICE-6778 - background test failure (diff) | |
download | ice-0df6f42a702bcc634cd3897fc21e38e05ef26fab.tar.bz2 ice-0df6f42a702bcc634cd3897fc21e38e05ef26fab.tar.xz ice-0df6f42a702bcc634cd3897fc21e38e05ef26fab.zip |
Fix for TCH-259 - assert on shutdown
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index ec04336d76c..a0faafc6145 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -1222,6 +1222,7 @@ IceInternal::IncomingConnectionFactory::flushAsyncBatchRequests(const Communicat bool IceInternal::IncomingConnectionFactory::startAsync(SocketOperation) { + assert(_acceptor); if(_state >= StateClosed) { return false; @@ -1245,6 +1246,7 @@ IceInternal::IncomingConnectionFactory::startAsync(SocketOperation) bool IceInternal::IncomingConnectionFactory::finishAsync(SocketOperation) { + assert(_acceptor); try { _acceptor->finishAccept(); @@ -1295,6 +1297,11 @@ IceInternal::IncomingConnectionFactory::message(ThreadPoolCurrent& current) _connections.erase(*p); } + if(!_acceptor) + { + return; + } + // // Now accept a new connection. // @@ -1411,7 +1418,14 @@ IceInternal::IncomingConnectionFactory::toString() const { return _transceiver->toString(); } - return _acceptor->toString(); + else if(_acceptor) + { + return _acceptor->toString(); + } + else + { + return string(); + } } NativeInfoPtr @@ -1421,9 +1435,14 @@ IceInternal::IncomingConnectionFactory::getNativeInfo() { return _transceiver->getNativeInfo(); } - - assert(_acceptor); - return _acceptor->getNativeInfo(); + else if(_acceptor) + { + return _acceptor->getNativeInfo(); + } + else + { + return 0; + } } void @@ -1705,6 +1724,7 @@ IceInternal::IncomingConnectionFactory::createAcceptor() if(_acceptor) { _acceptor->close(); + _acceptor = 0; } throw; } @@ -1722,4 +1742,13 @@ IceInternal::IncomingConnectionFactory::closeAcceptor() } _acceptor->close(); + +#if TARGET_OS_IPHONE != 0 + // + // Only clear the acceptor on iOS where it can be destroyed/re-created during the lifetime of the incoming + // connection factory. On other platforms, we keep it set. This is in particular import for IOCP/WinRT where + // finishAsync can be called after the acceptor is closed. + // + _acceptor = 0; +#endif } |