mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-17 13:20:25 -04:00
Added delay to auto announces on start
This commit is contained in:
parent
9824a8f7ea
commit
b86c811bde
2 changed files with 19 additions and 3 deletions
|
@ -3,6 +3,7 @@ import io
|
|||
import sys
|
||||
import time
|
||||
import atexit
|
||||
import threading
|
||||
import traceback
|
||||
import contextlib
|
||||
|
||||
|
@ -23,6 +24,8 @@ class NomadNetworkApp:
|
|||
|
||||
configdir = os.path.expanduser("~")+"/.nomadnetwork"
|
||||
|
||||
START_ANNOUNCE_DELAY = 3
|
||||
|
||||
def exit_handler(self):
|
||||
RNS.log("Nomad Network Client exit handler executing...", RNS.LOG_VERBOSE)
|
||||
RNS.log("Saving directory...", RNS.LOG_VERBOSE)
|
||||
|
@ -208,7 +211,13 @@ class NomadNetworkApp:
|
|||
self.autoselect_propagation_node()
|
||||
|
||||
if self.peer_announce_at_start:
|
||||
self.announce_now()
|
||||
def delayed_announce():
|
||||
time.sleep(NomadNetworkApp.START_ANNOUNCE_DELAY)
|
||||
self.announce_now()
|
||||
|
||||
da_thread = threading.Thread(target=delayed_announce)
|
||||
da_thread.setDaemon(True)
|
||||
da_thread.start()
|
||||
|
||||
atexit.register(self.exit_handler)
|
||||
sys.excepthook = self.exception_handler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue