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:
parent
d8244ccae3
commit
48fe6b7391
1 changed files with 3 additions and 0 deletions
|
@ -33,6 +33,8 @@ class Socket(IRCObject.Object):
|
||||||
self.bytes_written = 0
|
self.bytes_written = 0
|
||||||
self.bytes_read = 0
|
self.bytes_read = 0
|
||||||
|
|
||||||
|
self.connected_ip = None
|
||||||
|
|
||||||
def fileno(self) -> int:
|
def fileno(self) -> int:
|
||||||
return self.cached_fileno or self._socket.fileno()
|
return self.cached_fileno or self._socket.fileno()
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ class Socket(IRCObject.Object):
|
||||||
self._tls_wrap()
|
self._tls_wrap()
|
||||||
|
|
||||||
self._socket.connect((self._hostname, self._port))
|
self._socket.connect((self._hostname, self._port))
|
||||||
|
self.connected_ip, port = self._socket.getpeername()
|
||||||
self.cached_fileno = self._socket.fileno()
|
self.cached_fileno = self._socket.fileno()
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
|
|
Loading…
Reference in a new issue