Replaced lost UDPSocket.maxTimeOffset by constants.MAX_TIME_OFFSET
Closes: #1696
This commit is contained in:
parent
6ee6989df2
commit
79efacffb1
|
@ -8,6 +8,7 @@ import time
|
||||||
import protocol
|
import protocol
|
||||||
import state
|
import state
|
||||||
from bmproto import BMProto
|
from bmproto import BMProto
|
||||||
|
from constants import MAX_TIME_OFFSET
|
||||||
from node import Peer
|
from node import Peer
|
||||||
from objectracker import ObjectTracker
|
from objectracker import ObjectTracker
|
||||||
from queues import receiveDataQueue
|
from queues import receiveDataQueue
|
||||||
|
@ -81,8 +82,8 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
||||||
decodedIP = protocol.checkIPAddress(str(ip))
|
decodedIP = protocol.checkIPAddress(str(ip))
|
||||||
if stream not in state.streamsInWhichIAmParticipating:
|
if stream not in state.streamsInWhichIAmParticipating:
|
||||||
continue
|
continue
|
||||||
if (seenTime < time.time() - self.maxTimeOffset
|
if (seenTime < time.time() - MAX_TIME_OFFSET
|
||||||
or seenTime > time.time() + self.maxTimeOffset):
|
or seenTime > time.time() + MAX_TIME_OFFSET):
|
||||||
continue
|
continue
|
||||||
if decodedIP is False:
|
if decodedIP is False:
|
||||||
# if the address isn't local, interpret it as
|
# if the address isn't local, interpret it as
|
||||||
|
@ -93,7 +94,6 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"received peer discovery from %s:%i (port %i):",
|
"received peer discovery from %s:%i (port %i):",
|
||||||
self.destination.host, self.destination.port, remoteport)
|
self.destination.host, self.destination.port, remoteport)
|
||||||
if self.local:
|
|
||||||
state.discoveredPeers[Peer(self.destination.host, remoteport)] = \
|
state.discoveredPeers[Peer(self.destination.host, remoteport)] = \
|
||||||
time.time()
|
time.time()
|
||||||
return True
|
return True
|
||||||
|
|
Reference in New Issue
Block a user