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'
|
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'
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user