From 8cf0a0bb46f4b6c0ccf9bb551eb7d8cc263b7d5e Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sun, 28 Feb 2021 19:12:18 +0200 Subject: [PATCH] Move initialization of connectedAt to AdvancedDispatcher --- src/network/advanceddispatcher.py | 1 + src/network/proxy.py | 2 -- src/network/tcp.py | 1 - src/network/udp.py | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/network/advanceddispatcher.py b/src/network/advanceddispatcher.py index 8df557ad..b12ca1e4 100644 --- a/src/network/advanceddispatcher.py +++ b/src/network/advanceddispatcher.py @@ -31,6 +31,7 @@ class AdvancedDispatcher(asyncore.dispatcher): def __init__(self, sock=None): if not hasattr(self, '_map'): asyncore.dispatcher.__init__(self, sock) + self.connectedAt = 0 self.close_reason = None self.read_buf = bytearray() self.write_buf = bytearray() diff --git a/src/network/proxy.py b/src/network/proxy.py index 38676d66..953c15f5 100644 --- a/src/network/proxy.py +++ b/src/network/proxy.py @@ -113,7 +113,6 @@ class Proxy(AdvancedDispatcher): self.destination = address self.isOutbound = True self.fullyEstablished = False - self.connectedAt = 0 self.create_socket(socket.AF_INET, socket.SOCK_STREAM) if BMConfigParser().safeGetBoolean( "bitmessagesettings", "socksauthentication"): @@ -145,6 +144,5 @@ class Proxy(AdvancedDispatcher): def state_proxy_handshake_done(self): """Handshake is complete at this point""" - # pylint: disable=attribute-defined-outside-init self.connectedAt = time.time() return False diff --git a/src/network/tcp.py b/src/network/tcp.py index 1b30a0a2..ff778378 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -51,7 +51,6 @@ class TCPConnection(BMProto, TLSDispatcher): self.verackSent = False self.streams = [0] self.fullyEstablished = False - self.connectedAt = 0 self.skipUntil = 0 if address is None and sock is not None: self.destination = Peer(*sock.getpeername()) diff --git a/src/network/udp.py b/src/network/udp.py index 7852aeea..3f999332 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -28,7 +28,6 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes # .. todo:: sort out streams self.streams = [1] self.fullyEstablished = True - self.connectedAt = 0 self.skipUntil = 0 if sock is None: if host is None: