diff options
author | makefu <root@pigstarter.de> | 2014-01-14 09:53:20 +0100 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2014-01-14 09:53:20 +0100 |
commit | 8c2c2a68ae1db0e6ce86ce6f50df148f73a33989 (patch) | |
tree | f156b832445b256152979ec1c2e00a9a1f8a0f58 /Reaktor/IRC | |
parent | 883d70a810498b36ab174f2d3bfc2993e7502453 (diff) | |
parent | 5c5fc52820e94effbc64d0f248a8e262945c2ce3 (diff) |
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'Reaktor/IRC')
-rw-r--r-- | Reaktor/IRC/ircasy.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index ca607f2b..7821305f 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -21,7 +21,7 @@ class asybot(asychat): def __init__(self, server, port, nickname, channels, realname=False, username=False, hostname=False, hammer_interval=10, alarm_timeout=300, kill_timeout=360, loglevel=logging.ERROR): asychat.__init__(self) #logger magic - self.log = logging.getLogger('asybot') + self.log = logging.getLogger('asybot_' + nickname) hdlr = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON) formatter = logging.Formatter( '%(filename)s: %(levelname)s: %(message)s') hdlr.setFormatter(formatter) @@ -64,7 +64,10 @@ class asybot(asychat): self.alarm_timeout = alarm_timeout self.hammer_interval = hammer_interval self.kill_timeout = kill_timeout - signal(SIGALRM, lambda signum, frame: self.alarm_handler()) + try: + signal(SIGALRM, lambda signum, frame: self.alarm_handler()) + except Exception as e: + print('asybot: ' + str(e)) self.reset_alarm() def reset_alarm(self): @@ -128,7 +131,8 @@ class asybot(asychat): self.close() def reconnect(self): - self.push('QUIT') + if self.connected: + self.push('QUIT') self.close() self.create_socket(AF_INET, SOCK_STREAM) self.connect((self.server, self.port)) |