# HG changeset patch # User Teemu Piippo # Date 1417235046 18000 # Node ID 24f0b13e87d348f8ad4ac5d7a32cd1a226604f8e # Parent af912f53649cf4260ca6d24cdd8d77e2fe90a0c6 - fixed REST diff -r af912f53649c -r 24f0b13e87d3 cobalt.py --- a/cobalt.py Sat Nov 29 05:56:32 2014 +0200 +++ b/cobalt.py Fri Nov 28 23:24:06 2014 -0500 @@ -62,11 +62,10 @@ else: client.quit_irc() - quit() - #if g_BotActive: - # restart_self() - #else: - # quit() + if g_BotActive: + restart_self() + else: + quit() def restart_self(): os.execl (sys.executable, sys.executable, * sys.argv) @@ -100,7 +99,7 @@ for aconn in autoconnects: for conndata in Config.get_nodelist ('connections'): if conndata.get_value ('name') == aconn: - #Irc.irc_client (conndata, 0) + Irc.irc_client (conndata, 0) break else: raise ValueError ("unknown autoconnect entry %s" % (aconn)) diff -r af912f53649c -r 24f0b13e87d3 rest.py --- a/rest.py Sat Nov 29 05:56:32 2014 +0200 +++ b/rest.py Fri Nov 28 23:24:06 2014 -0500 @@ -49,7 +49,7 @@ # not in list g_throttle.append ([address, tt]) - Irc.broadcast ('Throttling %s:%s for 30 seconds' % address) + Irc.broadcast ('Throttling %s for 30 seconds' % address) def handle_rest_http (data, address): global g_credentials @@ -75,7 +75,7 @@ payload = match.group (1) if not authenticated: - Irc.broadcast ('%s:%s failed to authenticate' % address) + Irc.broadcast ('%s failed to authenticate' % address) throttle (address) return @@ -112,12 +112,11 @@ address = None def __init__ (self, conn, address): - asyncore.dispatcher.__init__ (self, conn, address) + asyncore.dispatcher.__init__ (self, conn) self.socket = ssl.wrap_socket (conn, server_side=True, keyfile='key.pem', certfile='cert.pem', do_handshake_on_connect=False) - self.socket.setblocking (0) + self.socket.settimeout (3) self.address = address - print 'Initialized connection handler for %s' % type (address) while True: try: