From da59bba930de58cac33b219c2d2fb0ebd088710f Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 18 Sep 2003 18:22:22 +0000 Subject: 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. --- miniircd | 4 ++-- 1 file 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) -- cgit v1.2.3