Typos, formatting, obsolete imports
This commit is contained in:
parent
71ca2a761b
commit
e9899743ef
|
@ -3,7 +3,6 @@ import inspect
|
||||||
import re
|
import re
|
||||||
from urllib import quote, quote_plus
|
from urllib import quote, quote_plus
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from debug import logger
|
|
||||||
|
|
||||||
class SafeHTMLParser(HTMLParser):
|
class SafeHTMLParser(HTMLParser):
|
||||||
# from html5lib.sanitiser
|
# from html5lib.sanitiser
|
||||||
|
|
|
@ -658,7 +658,8 @@ class receiveDataThread(threading.Thread):
|
||||||
|
|
||||||
with knownnodes.knownNodesLock:
|
with knownnodes.knownNodesLock:
|
||||||
if len(knownnodes.knownNodes[stream]) > 0:
|
if len(knownnodes.knownNodes[stream]) > 0:
|
||||||
filtered = {k: v for k, v in knownnodes.knownNodes[stream].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
filtered = {k: v for k, v in knownnodes.knownNodes[stream].items()
|
||||||
|
if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
||||||
elemCount = len(filtered)
|
elemCount = len(filtered)
|
||||||
if elemCount > 500:
|
if elemCount > 500:
|
||||||
elemCount = 500
|
elemCount = 500
|
||||||
|
@ -666,17 +667,19 @@ class receiveDataThread(threading.Thread):
|
||||||
addrsInMyStream = random.sample(filtered.items(), elemCount)
|
addrsInMyStream = random.sample(filtered.items(), elemCount)
|
||||||
# sent 250 only if the remote isn't interested in it
|
# sent 250 only if the remote isn't interested in it
|
||||||
if len(knownnodes.knownNodes[stream * 2]) > 0 and stream not in self.streamNumber:
|
if len(knownnodes.knownNodes[stream * 2]) > 0 and stream not in self.streamNumber:
|
||||||
filtered = {k: v for k, v in knownnodes.knownNodes[stream*2].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
filtered = {k: v for k, v in knownnodes.knownNodes[stream*2].items()
|
||||||
|
if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
||||||
elemCount = len(filtered)
|
elemCount = len(filtered)
|
||||||
if elemCount > 250:
|
if elemCount > 250:
|
||||||
elemCount = 250
|
elemCount = 250
|
||||||
addrsInMyStreamLeft = random.sample(filtered.items(), elemCount)
|
addrsInChildStreamLeft = random.sample(filtered.items(), elemCount)
|
||||||
if len(knownnodes.knownNodes[(stream * 2) + 1]) > 0 and stream not in self.streamNumber:
|
if len(knownnodes.knownNodes[(stream * 2) + 1]) > 0 and stream not in self.streamNumber:
|
||||||
filtered = {k: v for k, v in knownnodes.knownNodes[stream*2+1].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
filtered = {k: v for k, v in knownnodes.knownNodes[stream*2+1].items()
|
||||||
|
if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)}
|
||||||
elemCount = len(filtered)
|
elemCount = len(filtered)
|
||||||
if elemCount > 250:
|
if elemCount > 250:
|
||||||
elemCount = 250
|
elemCount = 250
|
||||||
addrsInMyStreamRight = random.sample(filtered.items(), elemCount)
|
addrsInChildStreamRight = random.sample(filtered.items(), elemCount)
|
||||||
numberOfAddressesInAddrMessage = 0
|
numberOfAddressesInAddrMessage = 0
|
||||||
payload = ''
|
payload = ''
|
||||||
for (HOST, PORT), timeLastReceivedMessageFromThisNode in addrsInMyStream:
|
for (HOST, PORT), timeLastReceivedMessageFromThisNode in addrsInMyStream:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Queue
|
import Queue
|
||||||
from multiprocessing import Queue as mpQueue, Lock as mpLock
|
|
||||||
from class_objectProcessorQueue import ObjectProcessorQueue
|
from class_objectProcessorQueue import ObjectProcessorQueue
|
||||||
|
|
||||||
workerQueue = Queue.Queue()
|
workerQueue = Queue.Queue()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user