summaryrefslogtreecommitdiff
path: root/gear/__init__.py
diff options
context:
space:
mode:
authorGregory Haynes <greg@greghaynes.net>2016-01-26 20:14:20 +0000
committerGregory Haynes <greg@greghaynes.net>2016-01-26 20:15:08 +0000
commitc313be6e181bd4916e3728d9889d865f011b51c7 (patch)
tree0011028945597a88637de4db619b327f2b36c72d /gear/__init__.py
parent5491e93d95e1dcde6de541f3e8a3452c9a0523d1 (diff)
downloadgear-c313be6e181bd4916e3728d9889d865f011b51c7.tar.gz
Guard against double shutdown in client0.5.9
If we have already performed a shutdown we can prevent exploding when writing to self.wake_write if we short circuit. Change-Id: If5352a373d5fa61dd1ee661f4a37976b3447dd9d
Diffstat (limited to 'gear/__init__.py')
-rw-r--r--gear/__init__.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/gear/__init__.py b/gear/__init__.py
index a4b8e23..7fccc34 100644
--- a/gear/__init__.py
+++ b/gear/__init__.py
@@ -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