Ensure socket is closed unconditionally (re: #169)
I cannot reproduce the bug locally, but this will force the socket to close if it didn't for whatever reason, which is what seems like could have caused the issue.
This commit is contained in:
parent
7a058f77e7
commit
6dd8f88bf6
@ -531,6 +531,8 @@ def forced_exit(cli, nick, chan, rest):
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
sys.exit()
|
||||
finally:
|
||||
cli.socket.close() # in case it didn't close, force it to
|
||||
|
||||
|
||||
def _restart_program(cli, mode=None):
|
||||
@ -616,8 +618,11 @@ def restart_program(cli, nick, chan, rest):
|
||||
nick, _, __, host = parse_nick(raw_nick)
|
||||
# restart the bot once our quit message goes though to ensure entire IRC queue is sent
|
||||
# if the bot is using a nick that isn't botconfig.NICK, then stop breaking things and fdie
|
||||
try:
|
||||
if nick == botconfig.NICK:
|
||||
_restart_program(cli, mode)
|
||||
finally:
|
||||
cli.socket.close()
|
||||
|
||||
# This is checked in the on_error handler. Some IRCds, such as InspIRCd, don't send the bot
|
||||
# its own QUIT message, so we need to use ERROR. Ideally, we shouldn't even need the above
|
||||
|
Loading…
Reference in New Issue
Block a user