summaryrefslogtreecommitdiff
path: root/python/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-06-23 15:27:03 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-06-23 15:27:03 +0200
commitd9fd16f6427706e790c3228f712642626e71e783 (patch)
tree43009dbaa7cfd8ff04e5d4b463fa54fc2702b4b6 /python/test
parentFixed ICE-7979 - Ice/ami server shutdown hang (diff)
downloadice-d9fd16f6427706e790c3228f712642626e71e783.tar.bz2
ice-d9fd16f6427706e790c3228f712642626e71e783.tar.xz
ice-d9fd16f6427706e790c3228f712642626e71e783.zip
Another fix for ICE-7979 - Ice/ami server shutdown hang
Diffstat (limited to 'python/test')
-rw-r--r--python/test/Ice/ami/TestI.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/python/test/Ice/ami/TestI.py b/python/test/Ice/ami/TestI.py
index ccdcf34d29d..96830493aff 100644
--- a/python/test/Ice/ami/TestI.py
+++ b/python/test/Ice/ami/TestI.py
@@ -14,6 +14,7 @@ class TestIntfI(Test.TestIntf):
self._cond = threading.Condition()
self._batchCount = 0
self._pending = None
+ self._shutdown = False
def op(self, current=None):
pass
@@ -52,24 +53,32 @@ class TestIntfI(Test.TestIntf):
def startDispatch(self, current=None):
with self._cond:
+ if self._shutdown:
+ # Ignore, this can occur with the forcefull connection close test, shutdown can be dispatch
+ # before start dispatch.
+ v = Ice.Future()
+ v.set_result(None)
+ return v
+ elif self._pending:
+ self._pending.set_result(None)
self._pending = Ice.Future()
- self._cond.notifyAll()
return self._pending
def finishDispatch(self, current=None):
with self._cond:
- while self._pending is None:
- self._cond.wait()
- self._pending.set_result(None)
- self._pending = None
+ if self._shutdown:
+ return
+ elif self._pending: # Pending might not be set yet if startDispatch is dispatch out-of-order
+ self._pending.set_result(None)
+ self._pending = None
def shutdown(self, current=None):
- #
- # Just in case a request arrived late.
- #
with self._cond:
- assert self._pending is None
- current.adapter.getCommunicator().shutdown()
+ self._shutdown = True
+ if self._pending:
+ self._pending.set_result(None)
+ self._pending = None
+ current.adapter.getCommunicator().shutdown()
def supportsAMD(self, current=None):
return True