Remove state.shutdown or replaced with self._stopped from some of the network threads #2222

Merged
anand-skss merged 1 commits from test4 into v0.6 2024-05-13 04:30:16 +02:00
4 changed files with 5 additions and 8 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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))

View File

@ -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