Remove state.shutdown or replaced with self._stopped from some network thread
This commit is contained in:
parent
3b36676793
commit
657c1de16b
|
@ -4,7 +4,6 @@ Announce addresses as they are received from other hosts
|
|||
from six.moves import queue
|
||||
|
||||
# magic imports!
|
||||
import state
|
||||
import connectionpool
|
||||
from helper_random import randomshuffle
|
||||
from protocol import assembleAddrMessage
|
||||
|
@ -18,7 +17,7 @@ class AddrThread(StoppableThread):
|
|||
name = "AddrBroadcaster"
|
||||
|
||||
def run(self):
|
||||
while not state.shutdown:
|
||||
while not self._stopped:
|
||||
chunk = []
|
||||
while True:
|
||||
try:
|
||||
|
|
|
@ -20,7 +20,7 @@ class AnnounceThread(StoppableThread):
|
|||
|
||||
def run(self):
|
||||
lastSelfAnnounced = 0
|
||||
while not self._stopped and state.shutdown == 0:
|
||||
while not self._stopped:
|
||||
processed = 0
|
||||
if lastSelfAnnounced < time.time() - self.announceInterval:
|
||||
self.announceSelf()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
A thread to handle network concerns
|
||||
"""
|
||||
import network.asyncore_pollchoose as asyncore
|
||||
import state
|
||||
import connectionpool
|
||||
from queues import excQueue
|
||||
from threads import StoppableThread
|
||||
|
@ -14,7 +13,7 @@ class BMNetworkThread(StoppableThread):
|
|||
|
||||
def run(self):
|
||||
try:
|
||||
while not self._stopped and state.shutdown == 0:
|
||||
while not self._stopped:
|
||||
connectionpool.pool.loop()
|
||||
except Exception as e:
|
||||
excQueue.put((self.name, e))
|
||||
|
|
|
@ -5,7 +5,6 @@ import errno
|
|||
import Queue
|
||||
import socket
|
||||
|
||||
import state
|
||||
import connectionpool
|
||||
from network.advanceddispatcher import UnknownStateError
|
||||
from queues import receiveDataQueue
|
||||
|
@ -19,13 +18,13 @@ class ReceiveQueueThread(StoppableThread):
|
|||
super(ReceiveQueueThread, self).__init__(name="ReceiveQueue_%i" % num)
|
||||
|
||||
def run(self):
|
||||
while not self._stopped and state.shutdown == 0:
|
||||
while not self._stopped:
|
||||
try:
|
||||
dest = receiveDataQueue.get(block=True, timeout=1)
|
||||
except Queue.Empty:
|
||||
continue
|
||||
|
||||
if self._stopped or state.shutdown:
|
||||
if self._stopped:
|
||||
break
|
||||
|
||||
# cycle as long as there is data
|
||||
|
|
Reference in New Issue
Block a user