summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2018-11-12 15:18:23 +0100
committerBenoit Foucher <benoit@zeroc.com>2018-11-12 15:18:46 +0100
commit5408915d05a37af5a74d67a585e6acff3bb996e4 (patch)
tree13bcc9fbf9844910bf80718f4aa9fb272af18d6f
parentAdd support to build PHP NuGet packages (diff)
downloadice-5408915d05a37af5a74d67a585e6acff3bb996e4.tar.bz2
ice-5408915d05a37af5a74d67a585e6acff3bb996e4.tar.xz
ice-5408915d05a37af5a74d67a585e6acff3bb996e4.zip
Another fix for the assert which could be triggered on OA destruction, fixes #291
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp41
-rw-r--r--csharp/src/Ice/ConnectionFactory.cs12
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java33
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java33
4 files changed, 54 insertions, 65 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 3e0aca17ba8..f6f61e6640a 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -1578,19 +1578,20 @@ IceInternal::IncomingConnectionFactory::finished(ThreadPoolCurrent&, bool close)
}
return;
}
-
- assert(_state == StateClosed);
- setState(StateFinished);
-
- if(_acceptorStarted && close)
+ else if(_state == StateClosed)
{
- closeAcceptor();
- }
+ setState(StateFinished);
+
+ if(_acceptorStarted && close)
+ {
+ closeAcceptor();
+ }
#if TARGET_OS_IPHONE != 0
- sync.release();
- unregisterForBackgroundNotification(ICE_SHARED_FROM_THIS);
+ sync.release();
+ unregisterForBackgroundNotification(ICE_SHARED_FROM_THIS);
#endif
+ }
}
string
@@ -1841,24 +1842,20 @@ IceInternal::IncomingConnectionFactory::setState(State state)
case StateClosed:
{
- if(_acceptorStarted)
+ //
+ // If possible, close the acceptor now to prevent new connections from
+ // being accepted while we are deactivating. This is especially useful
+ // if there are no more threads in the thread pool available to dispatch
+ // the finish() call. Not all selector implementations do support this
+ // however.
+ //
+ if(_adapter->getThreadPool()->finish(ICE_SHARED_FROM_THIS, true))
{
- //
- // If possible, close the acceptor now to prevent new connections from
- // being accepted while we are deactivating. This is especially useful
- // if there are no more threads in the thread pool available to dispatch
- // the finish() call. Not all selector implementations do support this
- // however.
- //
- if(_adapter->getThreadPool()->finish(ICE_SHARED_FROM_THIS, true))
+ if(_acceptorStarted)
{
closeAcceptor();
}
}
- else
- {
- state = StateFinished;
- }
#ifdef ICE_CPP11_COMPILER
for(const auto& conn : _connections)
diff --git a/csharp/src/Ice/ConnectionFactory.cs b/csharp/src/Ice/ConnectionFactory.cs
index fdfe0485537..ce7941142d5 100644
--- a/csharp/src/Ice/ConnectionFactory.cs
+++ b/csharp/src/Ice/ConnectionFactory.cs
@@ -1513,8 +1513,10 @@ namespace IceInternal
_instance.timer().schedule(new StartAcceptor(this), 1000);
return;
}
- Debug.Assert(_state == StateClosed);
- setState(StateFinished);
+ else if(_state == StateClosed)
+ {
+ setState(StateFinished);
+ }
}
}
@@ -1711,15 +1713,11 @@ namespace IceInternal
case StateClosed:
{
+ _adapter.getThreadPool().finish(this);
if(_acceptorStarted)
{
- _adapter.getThreadPool().finish(this);
closeAcceptor();
}
- else
- {
- state = StateFinished;
- }
foreach(Ice.ConnectionI connection in _connections)
{
diff --git a/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
index 6c041f0a76b..b73eaa3c251 100644
--- a/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
@@ -386,13 +386,14 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice
}, 1, java.util.concurrent.TimeUnit.SECONDS);
return;
}
-
- assert(_state == StateClosed);
- setState(StateFinished);
-
- if(_acceptorStarted && close)
+ else if(_state == StateClosed)
{
- closeAcceptor();
+ setState(StateFinished);
+
+ if(_acceptorStarted && close)
+ {
+ closeAcceptor();
+ }
}
}
@@ -629,23 +630,19 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice
case StateClosed:
{
- if(_acceptorStarted)
+ //
+ // If possible, close the acceptor now to prevent new connections from
+ // being accepted while we are deactivating. This is especially useful
+ // if there are no more threads in the thread pool available to dispatch
+ // the finish() call.
+ //
+ if(_adapter.getThreadPool().finish(this, true))
{
- //
- // If possible, close the acceptor now to prevent new connections from
- // being accepted while we are deactivating. This is especially useful
- // if there are no more threads in the thread pool available to dispatch
- // the finish() call.
- //
- if(_adapter.getThreadPool().finish(this, true))
+ if(_acceptorStarted)
{
closeAcceptor();
}
}
- else
- {
- state = StateFinished;
- }
for(Ice.ConnectionI connection : _connections)
{
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java
index 3e24b6ccfde..4f068a74651 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java
@@ -376,13 +376,14 @@ public final class IncomingConnectionFactory extends EventHandler implements Con
_instance.timer().schedule(() -> startAcceptor(), 1, java.util.concurrent.TimeUnit.SECONDS);
return;
}
-
- assert(_state == StateClosed);
- setState(StateFinished);
-
- if(_acceptorStarted && close)
+ else if(_state == StateClosed)
{
- closeAcceptor();
+ setState(StateFinished);
+
+ if(_acceptorStarted && close)
+ {
+ closeAcceptor();
+ }
}
}
@@ -620,23 +621,19 @@ public final class IncomingConnectionFactory extends EventHandler implements Con
case StateClosed:
{
- if(_acceptorStarted)
+ //
+ // If possible, close the acceptor now to prevent new connections from
+ // being accepted while we are deactivating. This is especially useful
+ // if there are no more threads in the thread pool available to dispatch
+ // the finish() call.
+ //
+ if(_adapter.getThreadPool().finish(this, true))
{
- //
- // If possible, close the acceptor now to prevent new connections from
- // being accepted while we are deactivating. This is especially useful
- // if there are no more threads in the thread pool available to dispatch
- // the finish() call.
- //
- if(_adapter.getThreadPool().finish(this, true))
+ if(_acceptorStarted)
{
closeAcceptor();
}
}
- else
- {
- state = StateFinished;
- }
for(ConnectionI connection : _connections)
{