Resend onionpeer object if it expired while the node ran
This commit is contained in:
parent
a5300e8584
commit
38e5d93272
|
@ -84,6 +84,7 @@ class singleCleaner(threading.Thread, StoppableThread):
|
||||||
int(time.time()) - 7380:
|
int(time.time()) - 7380:
|
||||||
timeWeLastClearedInventoryAndPubkeysTables = int(time.time())
|
timeWeLastClearedInventoryAndPubkeysTables = int(time.time())
|
||||||
Inventory().clean()
|
Inventory().clean()
|
||||||
|
queues.workerQueue.put(('sendOnionPeerObj', ''))
|
||||||
# pubkeys
|
# pubkeys
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"DELETE FROM pubkeys WHERE time<? AND usedpersonally='no'",
|
"DELETE FROM pubkeys WHERE time<? AND usedpersonally='no'",
|
||||||
|
|
|
@ -130,10 +130,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
queues.workerQueue.put(('sendbroadcast', ''))
|
queues.workerQueue.put(('sendbroadcast', ''))
|
||||||
|
|
||||||
# send onionpeer object
|
# send onionpeer object
|
||||||
for peer in state.ownAddresses:
|
queues.workerQueue.put(('sendOnionPeerObj', ''))
|
||||||
if peer.host.endswith('.onion'):
|
|
||||||
queues.workerQueue.put(('sendOnionPeerObj', peer))
|
|
||||||
break
|
|
||||||
|
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
self.busy = 0
|
self.busy = 0
|
||||||
|
@ -469,8 +466,14 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
' to the keys.dat file. Error message: %s', err
|
' to the keys.dat file. Error message: %s', err
|
||||||
)
|
)
|
||||||
|
|
||||||
def sendOnionPeerObj(self, peer):
|
def sendOnionPeerObj(self, peer=None):
|
||||||
"""Send onionpeer object representing peer"""
|
"""Send onionpeer object representing peer"""
|
||||||
|
if not peer: # find own onionhostname
|
||||||
|
for peer in state.ownAddresses:
|
||||||
|
if peer.host.endswith('.onion'):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
return
|
||||||
TTL = int(7 * 24 * 60 * 60 + helper_random.randomrandrange(-300, 300))
|
TTL = int(7 * 24 * 60 * 60 + helper_random.randomrandrange(-300, 300))
|
||||||
embeddedTime = int(time.time() + TTL)
|
embeddedTime = int(time.time() + TTL)
|
||||||
streamNumber = 1 # Don't know yet what should be here
|
streamNumber = 1 # Don't know yet what should be here
|
||||||
|
|
Reference in New Issue
Block a user