Skip to content

Commit

Permalink
[pymorse] Check if asyncore_thread is still alive
Browse files Browse the repository at this point in the history
If we call close more than once, the thread is already dead, so just do
nothing in this case.
Fix #557
  • Loading branch information
Arnaud Degroote committed Sep 1, 2014
1 parent eecbf9b commit df8d098
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bindings/pymorse/src/pymorse/pymorse.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ def close(self, cancel_async_services = False):
logger.info('Waiting for all asynchronous requests to complete...')
self.executor.shutdown(wait = True)
# Close all other asyncore sockets (StreanJSON)
Morse._asyncore_thread.syncstop(TIMEOUT)
if Morse._asyncore_thread:
Morse._asyncore_thread.syncstop(TIMEOUT)
asyncore.close_all()
Morse._asyncore_thread = None # in case we want to re-create
logger.info('Done. Bye bye!')
Expand Down

0 comments on commit df8d098

Please sign in to comment.