Fix for bug in Irc.removeCallback.

This commit is contained in:
Jeremy Fincher 2003-04-20 17:18:34 +00:00
parent e1dfcbd390
commit 2227f5caae

View File

@ -327,9 +327,9 @@ class Irc(object):
self.callbacks.append(callback) self.callbacks.append(callback)
def removeCallback(self, name): def removeCallback(self, name):
ret = filter(name.__eq__, self.callbacks) (bad, good) = partition(lambda cb: cb.name() == name, self.callbacks)
self.callbacks[:] = [cb for cb in self.callbacks if name != cb.name()] self.callbacks[:] = good
return ret return bad
def queueMsg(self, msg): def queueMsg(self, msg):
self.queue.enqueue(msg) self.queue.enqueue(msg)
@ -348,7 +348,7 @@ class Irc(object):
else: else:
self.lastTake = now self.lastTake = now
msg = self.queue.dequeue() msg = self.queue.dequeue()
elif len(self.outstandingPongs) > 2: elif len(self.outstandingPongs) >= 2:
# Our pings hasn't be responded to. # Our pings hasn't be responded to.
debug.msg('Reconnecting, 3 pings not replied to.', 'normal') debug.msg('Reconnecting, 3 pings not replied to.', 'normal')
if hasattr(self.driver, 'scheduleReconnect'): if hasattr(self.driver, 'scheduleReconnect'):