Guard against double shutdown in client
If we have already performed a shutdown we can prevent exploding when writing to self.wake_write if we short circuit. Change-Id: If5352a373d5fa61dd1ee661f4a37976b3447dd9d
This commit is contained in:
parent
5491e93d95
commit
c313be6e18
@ -1105,11 +1105,15 @@ class BaseClientServer(object):
|
||||
|
||||
The object may no longer be used after shutdown is called.
|
||||
"""
|
||||
self.log.debug("Beginning shutdown")
|
||||
self._shutdown()
|
||||
self.log.debug("Beginning cleanup")
|
||||
self._cleanup()
|
||||
self.log.debug("Finished shutdown")
|
||||
if self.running:
|
||||
self.log.debug("Beginning shutdown")
|
||||
self._shutdown()
|
||||
self.log.debug("Beginning cleanup")
|
||||
self._cleanup()
|
||||
self.log.debug("Finished shutdown")
|
||||
else:
|
||||
self.log.warning("Shutdown called when not currently running. "
|
||||
"Ignoring.")
|
||||
|
||||
def _shutdown(self):
|
||||
# The first part of the shutdown process where all threads
|
||||
|
@ -287,6 +287,11 @@ class TestClient(tests.BaseTestCase):
|
||||
acl.revokeGrant('manager')
|
||||
self.assertFalse(acl.canGrant('manager'))
|
||||
|
||||
def test_double_shutdown(self):
|
||||
client = gear.Client()
|
||||
client.shutdown()
|
||||
client.shutdown()
|
||||
|
||||
|
||||
def load_tests(loader, in_tests, pattern):
|
||||
return testscenarios.load_tests_apply_scenarios(loader, in_tests, pattern)
|
||||
|
Loading…
Reference in New Issue
Block a user