From 5b537eabe1a05a89ca49831306704264184d853d Mon Sep 17 00:00:00 2001 From: anand k Date: Mon, 24 Jun 2024 12:10:44 +0530 Subject: [PATCH] Moved portCheckerQueue and receiveDataQueue to network module --- src/network/__init__.py | 3 +++ src/network/bmproto.py | 4 ++-- src/network/connectionchooser.py | 5 ++++- src/network/receivequeuethread.py | 2 +- src/network/tcp.py | 4 ++-- src/network/tls.py | 2 +- src/network/udp.py | 2 +- src/queues.py | 2 -- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/network/__init__.py b/src/network/__init__.py index 073c8435..c87ad64d 100644 --- a/src/network/__init__.py +++ b/src/network/__init__.py @@ -1,6 +1,7 @@ """ Network subsystem package """ +from six.moves import queue from .dandelion import Dandelion from .threads import StoppableThread from .multiqueue import MultiQueue @@ -10,6 +11,8 @@ dandelion_ins = Dandelion() # network queues invQueue = MultiQueue() addrQueue = MultiQueue() +portCheckerQueue = queue.Queue() +receiveDataQueue = queue.Queue() __all__ = ["StoppableThread"] diff --git a/src/network/bmproto.py b/src/network/bmproto.py index 2b8dff79..e5f38bf5 100644 --- a/src/network/bmproto.py +++ b/src/network/bmproto.py @@ -17,7 +17,7 @@ import protocol import state import connectionpool from bmconfigparser import config -from queues import objectProcessorQueue, portCheckerQueue +from queues import objectProcessorQueue from randomtrackingdict import RandomTrackingDict from network.advanceddispatcher import AdvancedDispatcher from network.bmobject import ( @@ -26,7 +26,7 @@ from network.bmobject import ( BMObjectUnwantedStreamError ) from network.proxy import ProxyError -from network import dandelion_ins, invQueue +from network import dandelion_ins, invQueue, portCheckerQueue from node import Node, Peer from objectracker import ObjectTracker, missingObjects diff --git a/src/network/connectionchooser.py b/src/network/connectionchooser.py index d7062d24..e2981d51 100644 --- a/src/network/connectionchooser.py +++ b/src/network/connectionchooser.py @@ -5,11 +5,14 @@ Select which node to connect to import logging import random +from six.moves import queue + import knownnodes import protocol import state + from bmconfigparser import config -from queues import queue, portCheckerQueue +from network import portCheckerQueue logger = logging.getLogger('default') diff --git a/src/network/receivequeuethread.py b/src/network/receivequeuethread.py index 10f2acea..88d3b740 100644 --- a/src/network/receivequeuethread.py +++ b/src/network/receivequeuethread.py @@ -7,7 +7,7 @@ import socket import connectionpool from network.advanceddispatcher import UnknownStateError -from queues import receiveDataQueue +from network import receiveDataQueue from threads import StoppableThread diff --git a/src/network/tcp.py b/src/network/tcp.py index ec29c9ae..db7d6595 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -17,8 +17,8 @@ import state import connectionpool from bmconfigparser import config from highlevelcrypto import randomBytes -from network import dandelion_ins, invQueue -from queues import receiveDataQueue, UISignalQueue +from network import dandelion_ins, invQueue, receiveDataQueue +from queues import UISignalQueue from tr import _translate import asyncore_pollchoose as asyncore diff --git a/src/network/tls.py b/src/network/tls.py index a3774b44..2d5d5e1b 100644 --- a/src/network/tls.py +++ b/src/network/tls.py @@ -10,7 +10,7 @@ import sys import network.asyncore_pollchoose as asyncore import paths from network.advanceddispatcher import AdvancedDispatcher -from queues import receiveDataQueue +from network import receiveDataQueue logger = logging.getLogger('default') diff --git a/src/network/udp.py b/src/network/udp.py index b16146f9..30643d40 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -9,8 +9,8 @@ import time import protocol import state import connectionpool -from queues import receiveDataQueue +from network import receiveDataQueue from bmproto import BMProto from node import Peer from objectracker import ObjectTracker diff --git a/src/queues.py b/src/queues.py index 18eb6dfa..cee5ce8b 100644 --- a/src/queues.py +++ b/src/queues.py @@ -39,8 +39,6 @@ addressGeneratorQueue = queue.Queue() #: `.network.ReceiveQueueThread` instances dump objects they hear #: on the network into this queue to be processed. objectProcessorQueue = ObjectProcessorQueue() -portCheckerQueue = queue.Queue() -receiveDataQueue = queue.Queue() #: The address generator thread uses this queue to get information back #: to the API thread. apiAddressGeneratorReturnQueue = queue.Queue() -- 2.45.1