Skip to content

Commit 657c1de

Browse files
committed
Remove state.shutdown or replaced with self._stopped from some network thread
1 parent 3b36676 commit 657c1de

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

src/network/addrthread.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from six.moves import queue
55

66
# magic imports!
7-
import state
87
import connectionpool
98
from helper_random import randomshuffle
109
from protocol import assembleAddrMessage
@@ -18,7 +17,7 @@ class AddrThread(StoppableThread):
1817
name = "AddrBroadcaster"
1918

2019
def run(self):
21-
while not state.shutdown:
20+
while not self._stopped:
2221
chunk = []
2322
while True:
2423
try:

src/network/announcethread.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AnnounceThread(StoppableThread):
2020

2121
def run(self):
2222
lastSelfAnnounced = 0
23-
while not self._stopped and state.shutdown == 0:
23+
while not self._stopped:
2424
processed = 0
2525
if lastSelfAnnounced < time.time() - self.announceInterval:
2626
self.announceSelf()

src/network/networkthread.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
A thread to handle network concerns
33
"""
44
import network.asyncore_pollchoose as asyncore
5-
import state
65
import connectionpool
76
from queues import excQueue
87
from threads import StoppableThread
@@ -14,7 +13,7 @@ class BMNetworkThread(StoppableThread):
1413

1514
def run(self):
1615
try:
17-
while not self._stopped and state.shutdown == 0:
16+
while not self._stopped:
1817
connectionpool.pool.loop()
1918
except Exception as e:
2019
excQueue.put((self.name, e))

src/network/receivequeuethread.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import Queue
66
import socket
77

8-
import state
98
import connectionpool
109
from network.advanceddispatcher import UnknownStateError
1110
from queues import receiveDataQueue
@@ -19,13 +18,13 @@ def __init__(self, num=0):
1918
super(ReceiveQueueThread, self).__init__(name="ReceiveQueue_%i" % num)
2019

2120
def run(self):
22-
while not self._stopped and state.shutdown == 0:
21+
while not self._stopped:
2322
try:
2423
dest = receiveDataQueue.get(block=True, timeout=1)
2524
except Queue.Empty:
2625
continue
2726

28-
if self._stopped or state.shutdown:
27+
if self._stopped:
2928
break
3029

3130
# cycle as long as there is data

0 commit comments

Comments
 (0)