Simpler method of stopping connection threads

This commit is contained in:
TheKysek 2017-05-25 11:57:29 +02:00
parent 6e69c3d2b0
commit 962be9d1fb
No known key found for this signature in database
GPG Key ID: 50D9AF00D0B1C497
2 changed files with 1 additions and 8 deletions

View File

@ -105,7 +105,7 @@ class Connection(threading.Thread):
self.status = 'disconnecting' self.status = 'disconnecting'
if time.time() - self.last_message_sent > 300 and self.status == 'fully_established': if time.time() - self.last_message_sent > 300 and self.status == 'fully_established':
self.send_queue.put(message.Message(b'pong', b'')) self.send_queue.put(message.Message(b'pong', b''))
if self.status == 'disconnecting': if self.status == 'disconnecting' or shared.shutting_down:
data = None data = None
if not data: if not data:
self.status = 'disconnected' self.status = 'disconnected'

View File

@ -38,8 +38,6 @@ class Manager(threading.Thread):
self.last_pickled_nodes = now self.last_pickled_nodes = now
if shared.shutting_down: if shared.shutting_down:
logging.debug('Shutting down connections')
self.shutdown_connections()
logging.debug('Shutting down Manager') logging.debug('Shutting down Manager')
break break
@ -86,11 +84,6 @@ class Manager(threading.Thread):
shared.connections.add(c) shared.connections.add(c)
shared.hosts = hosts shared.hosts = hosts
@staticmethod
def shutdown_connections():
for c in shared.connections.copy():
c.send_queue.put(None)
@staticmethod @staticmethod
def pickle_objects(): def pickle_objects():
try: try: