summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2003-09-18 18:22:22 +0000
committerJoel Rosdahl <joel@rosdahl.net>2011-08-21 15:53:49 +0200
commitda59bba930de58cac33b219c2d2fb0ebd088710f (patch)
tree214b9015021b24db9ab558fffe4d1242e7e2eb39
parent10436ecc0669489df7d89540d76cbadb8707b62b (diff)
downloadminiircd-da59bba930de58cac33b219c2d2fb0ebd088710f.tar.gz
miniircd-da59bba930de58cac33b219c2d2fb0ebd088710f.zip
Fix use of socket.getpeername() after socket has been closed
Also remember the port from the call in the constructor and use the stored host and port when writing the disconnect message.
-rwxr-xr-xminiircd4
1 files changed, 2 insertions, 2 deletions
diff --git a/miniircd b/miniircd
index 020e3ed..742bc2c 100755
--- a/miniircd
+++ b/miniircd
@@ -59,7 +59,7 @@ class Client(object):
self.__writebuffer = ""
self.__nickname = None
self.__user = None
- self.__host = socket.getpeername()[0]
+ self.__host, self.__port = socket.getpeername()
self.__realname = None
self.__channels = {} # irc_lower(Channel name) --> Channel
if self.__server.password:
@@ -514,7 +514,7 @@ class Client(object):
self.message("ERROR :%s" % quitmsg)
addr = self.socket.getpeername()
self.__server.printInfo("Disconnected connection from %s:%s." % (
- addr[0], addr[1]))
+ self.__host, self.__port))
self.socket.close()
self.__server.removeClient(self, quitmsg)