diff --git a/src/IRCServer.py b/src/IRCServer.py index 25f8a495..52e1ab1c 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -58,9 +58,6 @@ class Server(IRCObject.Object): self.motd_lines = [] # type: typing.List[str] self.motd_done = False - self.last_read = time.monotonic() - self.last_send = None # type: typing.Optional[float] - self.attempted_join = {} # type: typing.Dict[str, typing.Optional[str]] self.ping_sent = False @@ -221,13 +218,13 @@ class Server(IRCObject.Object): def until_next_ping(self) -> typing.Optional[float]: if self.ping_sent: return None - return max(0, (self.last_read+PING_INTERVAL_SECONDS + return max(0, (self.socket.last_read+PING_INTERVAL_SECONDS )-time.monotonic()) def ping_due(self) -> bool: return self.until_next_ping() == 0 def until_read_timeout(self) -> float: - return max(0, (self.last_read+READ_TIMEOUT_SECONDS + return max(0, (self.socket.last_read+READ_TIMEOUT_SECONDS )-time.monotonic()) def read_timed_out(self) -> bool: return self.until_read_timeout == 0 diff --git a/src/IRCSocket.py b/src/IRCSocket.py index dcc61d31..dabfc8b3 100644 --- a/src/IRCSocket.py +++ b/src/IRCSocket.py @@ -35,6 +35,9 @@ class Socket(IRCObject.Object): self.bytes_written = 0 self.bytes_read = 0 + self.last_read = time.monotonic() + self.last_send = None # type: typing.Optional[float] + self.connected_ip = None def fileno(self) -> int: