announceInterval is for AnnounceThread, not UDPSocket
This commit is contained in:
parent
6168d63699
commit
5f9d507717
|
@ -7,7 +7,6 @@ import state
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from network.assemble import assemble_addr
|
from network.assemble import assemble_addr
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
from network.udp import UDPSocket
|
|
||||||
from node import Peer
|
from node import Peer
|
||||||
from threads import StoppableThread
|
from threads import StoppableThread
|
||||||
|
|
||||||
|
@ -15,12 +14,13 @@ from threads import StoppableThread
|
||||||
class AnnounceThread(StoppableThread):
|
class AnnounceThread(StoppableThread):
|
||||||
"""A thread to manage regular announcing of this node"""
|
"""A thread to manage regular announcing of this node"""
|
||||||
name = "Announcer"
|
name = "Announcer"
|
||||||
|
announceInterval = 60
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lastSelfAnnounced = 0
|
lastSelfAnnounced = 0
|
||||||
while not self._stopped and state.shutdown == 0:
|
while not self._stopped and state.shutdown == 0:
|
||||||
processed = 0
|
processed = 0
|
||||||
if lastSelfAnnounced < time.time() - UDPSocket.announceInterval:
|
if lastSelfAnnounced < time.time() - self.announceInterval:
|
||||||
self.announceSelf()
|
self.announceSelf()
|
||||||
lastSelfAnnounced = time.time()
|
lastSelfAnnounced = time.time()
|
||||||
if processed == 0:
|
if processed == 0:
|
||||||
|
|
|
@ -18,7 +18,6 @@ logger = logging.getLogger('default')
|
||||||
class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
||||||
"""Bitmessage protocol over UDP (class)"""
|
"""Bitmessage protocol over UDP (class)"""
|
||||||
port = 8444
|
port = 8444
|
||||||
announceInterval = 60
|
|
||||||
|
|
||||||
def __init__(self, host=None, sock=None, announcing=False):
|
def __init__(self, host=None, sock=None, announcing=False):
|
||||||
# pylint: disable=bad-super-call
|
# pylint: disable=bad-super-call
|
||||||
|
|
Loading…
Reference in New Issue
Block a user