Added pseudo-mailing-list feature; added Portable Mode feature #57
|
@ -481,7 +481,9 @@ class receiveDataThread(QThread):
|
||||||
headerData += 'inv\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
headerData += 'inv\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
||||||
headerData += pack('>L',len(payload))
|
headerData += pack('>L',len(payload))
|
||||||
headerData += hashlib.sha512(payload).digest()[:4]
|
headerData += hashlib.sha512(payload).digest()[:4]
|
||||||
|
printLock.acquire()
|
||||||
print 'Sending huge inv message with', numberOfObjects, 'objects to just this one peer'
|
print 'Sending huge inv message with', numberOfObjects, 'objects to just this one peer'
|
||||||
|
printLock.release()
|
||||||
self.sock.send(headerData + payload)
|
self.sock.send(headerData + payload)
|
||||||
|
|
||||||
#We have received a broadcast message
|
#We have received a broadcast message
|
||||||
|
@ -1560,7 +1562,13 @@ class receiveDataThread(QThread):
|
||||||
headerData += 'getdata\x00\x00\x00\x00\x00'
|
headerData += 'getdata\x00\x00\x00\x00\x00'
|
||||||
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce.
|
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce.
|
||||||
headerData += hashlib.sha512(payload).digest()[:4]
|
headerData += hashlib.sha512(payload).digest()[:4]
|
||||||
|
try:
|
||||||
self.sock.send(headerData + payload)
|
self.sock.send(headerData + payload)
|
||||||
|
except Exception, err:
|
||||||
|
if not 'Bad file descriptor' in err:
|
||||||
|
printLock.acquire()
|
||||||
|
sys.stderr.write('sock.send error: %s\n' % err)
|
||||||
|
printLock.release()
|
||||||
|
|
||||||
#We have received a getdata request from our peer
|
#We have received a getdata request from our peer
|
||||||
def recgetdata(self):
|
def recgetdata(self):
|
||||||
|
@ -1648,7 +1656,9 @@ class receiveDataThread(QThread):
|
||||||
numberOfAddressesIncluded, lengthOfNumberOfAddresses = decodeVarint(self.data[24:29])
|
numberOfAddressesIncluded, lengthOfNumberOfAddresses = decodeVarint(self.data[24:29])
|
||||||
|
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
|
printLock.acquire()
|
||||||
print 'addr message contains', numberOfAddressesIncluded, 'IP addresses.'
|
print 'addr message contains', numberOfAddressesIncluded, 'IP addresses.'
|
||||||
|
printLock.release()
|
||||||
#print 'lengthOfNumberOfAddresses', lengthOfNumberOfAddresses
|
#print 'lengthOfNumberOfAddresses', lengthOfNumberOfAddresses
|
||||||
|
|
||||||
if numberOfAddressesIncluded > 1000:
|
if numberOfAddressesIncluded > 1000:
|
||||||
|
@ -1719,7 +1729,9 @@ class receiveDataThread(QThread):
|
||||||
pickle.dump(knownNodes, output)
|
pickle.dump(knownNodes, output)
|
||||||
output.close()
|
output.close()
|
||||||
self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers)
|
self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers)
|
||||||
|
printLock.acquire()
|
||||||
print 'knownNodes currently has', len(knownNodes[recaddrStream]), 'nodes for this stream.'
|
print 'knownNodes currently has', len(knownNodes[recaddrStream]), 'nodes for this stream.'
|
||||||
|
printLock.release()
|
||||||
|
|
||||||
#Function runs when we want to broadcast an addr message to all of our peers. Runs when we learn of nodes that we didn't previously know about and want to share them with our peers.
|
#Function runs when we want to broadcast an addr message to all of our peers. Runs when we learn of nodes that we didn't previously know about and want to share them with our peers.
|
||||||
def broadcastaddr(self,listOfAddressDetailsToBroadcastToPeers):
|
def broadcastaddr(self,listOfAddressDetailsToBroadcastToPeers):
|
||||||
|
|
|
@ -10,9 +10,11 @@ def createDefaultKnownNodes(appdata):
|
||||||
############## Stream 1 ################
|
############## Stream 1 ################
|
||||||
stream1 = {}
|
stream1 = {}
|
||||||
|
|
||||||
stream1['66.108.210.244'] = (8080,int(time.time()))
|
stream1['66.65.120.151'] = (8080,int(time.time()))
|
||||||
|
stream1['76.180.233.38'] = (8444,int(time.time()))
|
||||||
|
stream1['84.48.88.42'] = (8444,int(time.time()))
|
||||||
|
stream1['74.132.73.137'] = (8444,int(time.time()))
|
||||||
stream1['60.242.109.18'] = (8444,int(time.time()))
|
stream1['60.242.109.18'] = (8444,int(time.time()))
|
||||||
stream1['84.48.88.49'] = (8444,int(time.time()))
|
|
||||||
|
|
||||||
############# Stream 2 #################
|
############# Stream 2 #################
|
||||||
stream2 = {}
|
stream2 = {}
|
||||||
|
|
Reference in New Issue
Block a user