A few bug fixes and tweaks for the accelerate module

This commit is contained in:
James Cammarata 2015-10-02 00:48:04 -04:00
parent 45c5b4bf4b
commit 79d18981c7

View file

@ -272,6 +272,7 @@ class LocalSocketThread(Thread):
pass pass
def terminate(self): def terminate(self):
super(LocalSocketThread, self).terminate()
self.terminated = True self.terminated = True
self.s.shutdown(socket.SHUT_RDWR) self.s.shutdown(socket.SHUT_RDWR)
self.s.close() self.s.close()
@ -311,7 +312,6 @@ class ThreadedTCPServer(SocketServer.ThreadingTCPServer):
SocketServer.ThreadingTCPServer.__init__(self, server_address, RequestHandlerClass) SocketServer.ThreadingTCPServer.__init__(self, server_address, RequestHandlerClass)
def shutdown(self): def shutdown(self):
self.local_thread.terminate()
self.running = False self.running = False
SocketServer.ThreadingTCPServer.shutdown(self) SocketServer.ThreadingTCPServer.shutdown(self)
@ -599,15 +599,14 @@ def daemonize(module, password, port, timeout, minutes, use_ipv6, pid_file):
server.shutdown() server.shutdown()
else: else:
# reschedule the check # reschedule the check
vvvv("daemon idle for %d seconds (timeout=%d)" % (total_seconds,minutes*60)) signal.alarm(1)
signal.alarm(30)
except: except:
pass pass
finally: finally:
server.last_event_lock.release() server.last_event_lock.release()
signal.signal(signal.SIGALRM, timer_handler) signal.signal(signal.SIGALRM, timer_handler)
signal.alarm(30) signal.alarm(1)
tries = 5 tries = 5
while tries > 0: while tries > 0: