Made sure to catch exceptions in takeMsg.

This commit is contained in:
Jeremy Fincher 2004-01-20 15:41:42 +00:00
parent 68c4ca6895
commit 67db74e500
3 changed files with 15 additions and 3 deletions

View File

@ -83,7 +83,11 @@ class AsyncoreDriver(asynchat.async_chat, object):
def writable(self):
while self.connected:
m = self.irc.takeMsg()
try:
m = self.irc.takeMsg()
except Exception, e:
log.exception('Uncaught exception in irclib.Irc.takeMsg:')
return
if m:
self.push(str(m))
else:

View File

@ -75,7 +75,11 @@ class SocketDriver(drivers.IrcDriver):
self.reconnect()
def _sendIfMsgs(self):
msgs = [self.irc.takeMsg()]
try:
msgs = [self.irc.takeMsg()]
except Exception, e:
log.exception('Uncaught exception in irclib.Irc.takeMsg:')
return
while msgs[-1] is not None:
msgs.append(self.irc.takeMsg())
del msgs[-1]

View File

@ -69,7 +69,11 @@ class SupyIrcProtocol(LineReceiver):
def checkIrcForMsgs(self):
if self.connected:
msg = self.factory.irc.takeMsg()
try:
msg = self.factory.irc.takeMsg()
except Exception, e:
log.exception('Uncaught exception in irclib.Irc.takeMsg:')
return
if msg:
self.transport.write(str(msg))
self.mostRecentCall = reactor.callLater(1, self.checkIrcForMsgs)