Simpler method of stopping connection threads
This commit is contained in:
parent
6e69c3d2b0
commit
962be9d1fb
|
@ -105,7 +105,7 @@ class Connection(threading.Thread):
|
|||
self.status = 'disconnecting'
|
||||
if time.time() - self.last_message_sent > 300 and self.status == 'fully_established':
|
||||
self.send_queue.put(message.Message(b'pong', b''))
|
||||
if self.status == 'disconnecting':
|
||||
if self.status == 'disconnecting' or shared.shutting_down:
|
||||
data = None
|
||||
if not data:
|
||||
self.status = 'disconnected'
|
||||
|
|
|
@ -38,8 +38,6 @@ class Manager(threading.Thread):
|
|||
self.last_pickled_nodes = now
|
||||
|
||||
if shared.shutting_down:
|
||||
logging.debug('Shutting down connections')
|
||||
self.shutdown_connections()
|
||||
logging.debug('Shutting down Manager')
|
||||
break
|
||||
|
||||
|
@ -86,11 +84,6 @@ class Manager(threading.Thread):
|
|||
shared.connections.add(c)
|
||||
shared.hosts = hosts
|
||||
|
||||
@staticmethod
|
||||
def shutdown_connections():
|
||||
for c in shared.connections.copy():
|
||||
c.send_queue.put(None)
|
||||
|
||||
@staticmethod
|
||||
def pickle_objects():
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user