print'deleting ',peer,'from shared.knownNodes because it caused a socks.socksocket exception. We must not be 64-bit compatible.'
@ -169,14 +170,24 @@ class outgoingSynSender(threading.Thread):
withshared.printLock:
print'Could NOT connect to',peer,'during outgoing attempt.',err
timeLastSeen=shared.knownNodes[
self.streamNumber][peer]
if(int(time.time())-timeLastSeen)>172800andlen(shared.knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the shared.knownNodes data-structure.
if(int(time.time())-timeLastSeen)>172800andlen(shared.knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the shared.knownNodes data-structure.
delshared.knownNodes[self.streamNumber][peer]
deletedPeer=peer
ifdeletedPeer:
withshared.printLock:
print'deleting ',peer,'from shared.knownNodes because it is more than 48 hours old and we could not connect to it.'
print'deleting',peer,'from shared.knownNodes because it is more than 48 hours old and we could not connect to it.'
exceptsocks.Socks5AuthErroraserr:
shared.UISignalQueue.put((
@ -195,14 +206,24 @@ class outgoingSynSender(threading.Thread):
withshared.printLock:
print'Could NOT connect to',peer,'during outgoing attempt.',err
timeLastSeen=shared.knownNodes[
self.streamNumber][peer]
if(int(time.time())-timeLastSeen)>172800andlen(shared.knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the knownNodes data-structure.
shared.knownNodesLock.acquire()
delshared.knownNodes[self.streamNumber][peer]
shared.knownNodesLock.release()
withshared.printLock:
print'deleting ',peer,'from knownNodes because it is more than 48 hours old and we could not connect to it.'
if(int(time.time())-timeLastSeen)>172800andlen(shared.knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the shared.knownNodes data-structure.
delshared.knownNodes[self.streamNumber][peer]
deletedPeer=peer
ifdeletedPeer:
withshared.printLock:
print'deleting',peer,'from shared.knownNodes because it is more than 48 hours old and we could not connect to it.'
shared.numberOfBytesReceived+=len(dataRecv)# for the 'network status' UI tab. The UI clears this value whenever it updates.
shared.numberOfBytesReceivedLastSecond+=len(dataRecv)# for the download rate limit
exceptsocket.timeout:
withshared.printLock:
print'Timeout occurred waiting for data from',self.peer,'. Closing receiveData thread. (ID:',str(id(self))+')'
@ -117,7 +131,7 @@ class receiveDataThread(threading.Thread):
ifmagic!=0xE9BEB4D9:
self.data=""
return
ifpayloadLength>2 **18:# 256 KiB
ifpayloadLength>1600100:# ~1.6 MB which is the maximum possible size of an inv message.
logger.info('The incoming message, which we have not yet download, is too large. Ignoring it. (unfortunately there is no way to tell the other node to stop sending it except to disconnect.) Message size: %s'%payloadLength)
self.sendDataThreadQueue.put((0,'sendRawData',shared.assembleErrorMessage(fatal=2,errorText="Your time is too far in the future compared to mine. Closing connection.")))
logger.info("%s's time is too far in the future (%s seconds). Closing connection to it."%(self.peer,timeOffset))
self.sendDataThreadQueue.put((0,'sendRawData',shared.assembleErrorMessage(fatal=2,errorText="Your time is too far in the past compared to mine. Closing connection.")))
logger.info("%s's time is too far in the past (timeOffset %s seconds). Closing connection to it."%(self.peer,timeOffset))
shared.config.set('bitmessagesettings','identiconsuffix',''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")forxinrange(12)))# a twelve character pseudo-password to salt the identicons
numberOfBytesReceived=0# Used for the 'network status' page
numberOfBytesSent=0# Used for the 'network status' page
numberOfBytesReceivedLastSecond=0# used for the bandwidth rate limit
numberOfBytesSentLastSecond=0# used for the bandwidth rate limit
lastTimeWeResetBytesReceived=0# used for the bandwidth rate limit
lastTimeWeResetBytesSent=0# used for the bandwidth rate limit
sendDataLock=threading.Lock()# used for the bandwidth rate limit
receiveDataLock=threading.Lock()# used for the bandwidth rate limit
daemon=False
inventorySets={}# key = streamNumer, value = a set which holds the inventory object hashes that we are aware of. This is used whenever we receive an inv message from a peer to check to see what items are new to us. We don't delete things out of it; instead, the singleCleaner thread clears and refills it every couple hours.
needToWriteKnownNodesToDisk=False# If True, the singleCleaner will write it to disk eventually.