Tried to make sure Ircs and Drivers get nuked appropriately when they die sadly.

This commit is contained in:
Jeremy Fincher 2004-01-20 16:07:03 +00:00
parent d77bd968ae
commit 39856a6172
2 changed files with 14 additions and 6 deletions

View File

@ -138,6 +138,9 @@ def run():
_deadDrivers.append(name)
for name in _deadDrivers:
try:
driver = _drivers[name]
driver.irc.driver = None
driver.irc = None
del _drivers[name]
except KeyError:
pass

View File

@ -63,14 +63,14 @@ class SupyIrcProtocol(LineReceiver):
msg = ircmsgs.IrcMsg(line)
log.debug('Time to parse IrcMsg: %s', time.time()-start)
try:
self.factory.irc.feedMsg(msg)
self.irc.feedMsg(msg)
except:
log.exception('Uncaught exception outside Irc object:')
def checkIrcForMsgs(self):
if self.connected:
try:
msg = self.factory.irc.takeMsg()
msg = self.irc.takeMsg()
except Exception, e:
log.exception('Uncaught exception in irclib.Irc.takeMsg:')
return
@ -80,15 +80,15 @@ class SupyIrcProtocol(LineReceiver):
def connectionLost(self, failure):
self.mostRecentCall.cancel()
self.factory.irc.reset()
self.irc.reset()
log.warning(failure.getErrorMessage())
def connectionMade(self):
self.factory.irc.reset()
self.factory.irc.driver = self
self.irc.reset()
self.irc.driver = self
def die(self):
log.info('Driver for %s dying.', self.factory.irc)
log.info('Driver for %s dying.', self.irc)
self.factory.continueTrying = False
self.transport.loseConnection()
@ -104,6 +104,11 @@ class SupyReconnectingFactory(ReconnectingClientFactory):
self.server = (server, port)
reactor.connectTCP(server, port, self)
def buildProtocol(self, addr):
protocol = ReconnectingClientFactory.buildProtocol(self, addr)
protocol.irc = self.irc
return protocol
def die(self):
pass