From 2227f5caaeb48d06ea168952bab616a7c903842f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 20 Apr 2003 17:18:34 +0000 Subject: [PATCH] Fix for bug in Irc.removeCallback. --- src/irclib.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index 802aa38b7..ab11e971c 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -327,9 +327,9 @@ class Irc(object): self.callbacks.append(callback) def removeCallback(self, name): - ret = filter(name.__eq__, self.callbacks) - self.callbacks[:] = [cb for cb in self.callbacks if name != cb.name()] - return ret + (bad, good) = partition(lambda cb: cb.name() == name, self.callbacks) + self.callbacks[:] = good + return bad def queueMsg(self, msg): self.queue.enqueue(msg) @@ -348,7 +348,7 @@ class Irc(object): else: self.lastTake = now msg = self.queue.dequeue() - elif len(self.outstandingPongs) > 2: + elif len(self.outstandingPongs) >= 2: # Our pings hasn't be responded to. debug.msg('Reconnecting, 3 pings not replied to.', 'normal') if hasattr(self.driver, 'scheduleReconnect'):