10
10
import time
11
11
12
12
# magic imports!
13
- import addresses
14
13
import helper_random
15
14
import l10n
16
- import protocol
17
- import state
15
+ from network import protocol , state , config , queues , addresses , dandelion_ins
18
16
import connectionpool
19
- from bmconfigparser import config
20
17
from highlevelcrypto import randomBytes
21
- from network import dandelion_ins
22
- from queues import invQueue , receiveDataQueue , UISignalQueue
23
18
from tr import _translate
24
19
25
20
import asyncore_pollchoose as asyncore
@@ -109,7 +104,7 @@ def antiIntersectionDelay(self, initial=False):
109
104
max_known_nodes = max (
110
105
len (knownnodes .knownNodes [x ]) for x in knownnodes .knownNodes )
111
106
delay = math .ceil (math .log (max_known_nodes + 2 , 20 )) * (
112
- 0.2 + invQueue .queueCount / 2.0 )
107
+ 0.2 + queues . invQueue .queueCount / 2.0 )
113
108
# take the stream with maximum amount of nodes
114
109
# +2 is to avoid problems with log(0) and log(1)
115
110
# 20 is avg connected nodes count
@@ -135,7 +130,7 @@ def checkTimeOffsetNotification(self):
135
130
if BMProto .timeOffsetWrongCount > \
136
131
maximumTimeOffsetWrongCount and \
137
132
not self .fullyEstablished :
138
- UISignalQueue .put ((
133
+ queues . UISignalQueue .put ((
139
134
'updateStatusBar' ,
140
135
_translate (
141
136
"MainWindow" ,
@@ -158,8 +153,8 @@ def set_connection_fully_established(self):
158
153
"""Initiate inventory synchronisation."""
159
154
if not self .isOutbound and not self .local :
160
155
state .clientHasReceivedIncomingConnections = True
161
- UISignalQueue .put (('setStatusIcon' , 'green' ))
162
- UISignalQueue .put ((
156
+ queues . UISignalQueue .put (('setStatusIcon' , 'green' ))
157
+ queues . UISignalQueue .put ((
163
158
'updateNetworkStatusTab' , (self .isOutbound , True , self .destination )
164
159
))
165
160
self .antiIntersectionDelay (True )
@@ -169,7 +164,7 @@ def set_connection_fully_established(self):
169
164
knownnodes .increaseRating (self .destination )
170
165
knownnodes .addKnownNode (
171
166
self .streams , self .destination , time .time ())
172
- dandelion_ins .maybeAddStem (self , invQueue )
167
+ dandelion_ins .maybeAddStem (self , queues . invQueue )
173
168
self .sendAddr ()
174
169
self .sendBigInv ()
175
170
@@ -271,12 +266,12 @@ def handle_connect(self):
271
266
connectionpool .pool .streams , dandelion_ins .enabled ,
272
267
False , nodeid = self .nodeid ))
273
268
self .connectedAt = time .time ()
274
- receiveDataQueue .put (self .destination )
269
+ queues . receiveDataQueue .put (self .destination )
275
270
276
271
def handle_read (self ):
277
272
"""Callback for reading from a socket"""
278
273
TLSDispatcher .handle_read (self )
279
- receiveDataQueue .put (self .destination )
274
+ queues . receiveDataQueue .put (self .destination )
280
275
281
276
def handle_write (self ):
282
277
"""Callback for writing to a socket"""
@@ -286,7 +281,7 @@ def handle_close(self):
286
281
"""Callback for connection being closed."""
287
282
host_is_global = self .isOutbound or not self .local and not state .socksIP
288
283
if self .fullyEstablished :
289
- UISignalQueue .put ((
284
+ queues . UISignalQueue .put ((
290
285
'updateNetworkStatusTab' ,
291
286
(self .isOutbound , False , self .destination )
292
287
))
0 commit comments