From 3a82cc00cd3fa3c966f87b1f95995e8034f7e115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9munaire?= Date: Fri, 2 Nov 2012 13:58:34 +0100 Subject: [PATCH] Fix nemubot shutdown when some DCC connections are alive --- DCC.py | 3 ++- IRCServer.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DCC.py b/DCC.py index 042b8a8..85ca1ec 100644 --- a/DCC.py +++ b/DCC.py @@ -22,6 +22,7 @@ import re import socket import sys import time +import threading import traceback import message @@ -202,7 +203,7 @@ class DCC(server.Server): if self.realname in self.srv.dcc_clients: del self.srv.dcc_clients[self.realname] - print ("Close connection with", self.nick) + print ("Closing connection with", self.nick) self.stopping.set() #Rearm Thread threading.Thread.__init__(self) diff --git a/IRCServer.py b/IRCServer.py index 2ae85da..93d482d 100644 --- a/IRCServer.py +++ b/IRCServer.py @@ -194,7 +194,8 @@ class IRCServer(server.Server): def disconnect(self): """Close the socket with the server and all DCC client connections""" #Close all DCC connection - for clt in self.dcc_clients: + clts = [c for c in self.dcc_clients] + for clt in clts: self.dcc_clients[clt].disconnect() return server.Server.disconnect(self)