announceInterval is for AnnounceThread, not UDPSocket

This commit is contained in:
Dmitri Bogomolov 2021-01-27 21:46:21 +02:00
parent 6168d63699
commit 5f9d507717
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 2 additions and 3 deletions

View File

@ -7,7 +7,6 @@ import state
from bmconfigparser import BMConfigParser
from network.assemble import assemble_addr
from network.connectionpool import BMConnectionPool
from network.udp import UDPSocket
from node import Peer
from threads import StoppableThread
@ -15,12 +14,13 @@ from threads import StoppableThread
class AnnounceThread(StoppableThread):
"""A thread to manage regular announcing of this node"""
name = "Announcer"
announceInterval = 60
def run(self):
lastSelfAnnounced = 0
while not self._stopped and state.shutdown == 0:
processed = 0
if lastSelfAnnounced < time.time() - UDPSocket.announceInterval:
if lastSelfAnnounced < time.time() - self.announceInterval:
self.announceSelf()
lastSelfAnnounced = time.time()
if processed == 0:

View File

@ -18,7 +18,6 @@ logger = logging.getLogger('default')
class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
"""Bitmessage protocol over UDP (class)"""
port = 8444
announceInterval = 60
def __init__(self, host=None, sock=None, announcing=False):
# pylint: disable=bad-super-call