3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 19:52:53 +01:00

inspircd: stop ENDBURST timers when irc.aborted gets set

This commit is contained in:
James Lu 2017-05-07 13:56:55 -07:00
parent 15ed251ed7
commit b83aba0b13

View File

@ -370,12 +370,18 @@ class InspIRCdProtocol(TS6BaseProtocol):
self._send(uplink, 'SERVER %s * 1 %s :%s' % (name, sid, desc))
self.irc.servers[sid] = IrcServer(uplink, name, internal=True, desc=desc)
endburstf = lambda: self._send(sid, 'ENDBURST')
if endburst_delay:
def endburstf():
# Delay ENDBURST by X seconds if requested.
threading.Timer(endburst_delay, endburstf, ()).start()
if self.irc.aborted.wait(endburst_delay):
# We managed to catch the abort flag before sending ENDBURST, so break
log.debug('(%s) stopping endburstf() for %s as aborted was set', self.irc.name, sid)
return
self._send(sid, 'ENDBURST')
if endburst_delay:
threading.Thread(target=endburstf).start()
else: # Else, send burst immediately
endburstf()
self._send(sid, 'ENDBURST')
return sid
def squit(self, source, target, text='No reason given'):