- fixed REST

Fri, 28 Nov 2014 23:24:06 -0500

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Fri, 28 Nov 2014 23:24:06 -0500
changeset 96
24f0b13e87d3
parent 95
af912f53649c
child 97
55d7d9aea160

- fixed REST

cobalt.py file | annotate | diff | comparison | revisions
rest.py file | annotate | diff | comparison | revisions
--- 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))
--- 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:

mercurial