Move initialization of connectedAt to AdvancedDispatcher

This commit is contained in:
Dmitri Bogomolov 2021-02-28 19:12:18 +02:00
parent 3e421635e1
commit 5190e9c49a
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
4 changed files with 1 additions and 4 deletions

View File

@ -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()

View File

@ -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

View File

@ -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())

View File

@ -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: