Excessive random seeding

- outgoing thread was calling a seed reinit before each peer selection.
  This is not necessary, just init when the thread starts
This commit is contained in:
Peter Šurda 2017-02-28 09:40:28 +01:00
parent 42246f83ef
commit f5b430b567
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -25,6 +25,7 @@ class outgoingSynSender(threading.Thread, StoppableThread):
def __init__(self): def __init__(self):
threading.Thread.__init__(self, name="outgoingSynSender") threading.Thread.__init__(self, name="outgoingSynSender")
self.initStop() self.initStop()
random.seed()
def setup(self, streamNumber, selfInitiatedConnections): def setup(self, streamNumber, selfInitiatedConnections):
self.streamNumber = streamNumber self.streamNumber = streamNumber
@ -83,11 +84,9 @@ class outgoingSynSender(threading.Thread, StoppableThread):
self.stop.wait(10) self.stop.wait(10)
if state.shutdown: if state.shutdown:
break break
random.seed()
peer = self._getPeer() peer = self._getPeer()
while peer in shared.alreadyAttemptedConnectionsList or peer.host in shared.connectedHostsList: while peer in shared.alreadyAttemptedConnectionsList or peer.host in shared.connectedHostsList:
# print 'choosing new sample' # print 'choosing new sample'
random.seed()
peer = self._getPeer() peer = self._getPeer()
self.stop.wait(1) self.stop.wait(1)
if self._stopped: if self._stopped: