Bugfix for darelf's IRC server.

This commit is contained in:
Jeremy Fincher 2004-08-23 13:41:04 +00:00
parent 25efb6fc74
commit b099b66272
4 changed files with 13 additions and 6 deletions

View File

@ -103,7 +103,8 @@ class AsyncoreDriver(asynchat.async_chat, drivers.ServersMixin):
start = time.time()
msg = drivers.parseMsg(self.buffer)
self.buffer = ''
self.irc.feedMsg(msg)
if msg is not None:
self.irc.feedMsg(msg)
def handle_close(self):
self._scheduleReconnect()

View File

@ -200,8 +200,12 @@ def newDriver(irc, moduleName=None):
def parseMsg(s):
start = time.time()
msg = ircmsgs.IrcMsg(s)
log.stat('Time to parse IrcMsg: %s', time.time()-start)
return msg
s = s.strip()
if s:
msg = ircmsgs.IrcMsg(s)
log.stat('Time to parse IrcMsg: %s', time.time()-start)
return msg
else:
return None
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -109,7 +109,8 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
self.inbuffer = lines.pop()
for line in lines:
msg = drivers.parseMsg(line)
self.irc.feedMsg(msg)
if msg is not None:
self.irc.feedMsg(msg)
except socket.timeout:
pass
except socket.error, e:

View File

@ -61,7 +61,8 @@ class SupyIrcProtocol(LineReceiver):
def lineReceived(self, line):
start = time.time()
msg = drivers.parseMsg(line)
self.irc.feedMsg(msg)
if msg is not None:
self.irc.feedMsg(msg)
def checkIrcForMsgs(self):
if self.connected: