Add IRCSocket.connected_ip to hold on to the IP address we connected to (e.g.

so we know which IP we picked from a round robin DNS)
This commit is contained in:
jesopo 2019-02-11 16:10:23 +00:00
parent d8244ccae3
commit 48fe6b7391

View file

@ -33,6 +33,8 @@ class Socket(IRCObject.Object):
self.bytes_written = 0
self.bytes_read = 0
self.connected_ip = None
def fileno(self) -> int:
return self.cached_fileno or self._socket.fileno()
@ -57,6 +59,7 @@ class Socket(IRCObject.Object):
self._tls_wrap()
self._socket.connect((self._hostname, self._port))
self.connected_ip, port = self._socket.getpeername()
self.cached_fileno = self._socket.fileno()
def disconnect(self):