Stop checkconnections with connectionserver
This commit is contained in:
parent
8e79a7da63
commit
6d425f30fe
1 changed files with 8 additions and 2 deletions
|
@ -47,6 +47,7 @@ class ConnectionServer(object):
|
||||||
self.stream_server_proxy = None
|
self.stream_server_proxy = None
|
||||||
self.running = False
|
self.running = False
|
||||||
self.stopping = False
|
self.stopping = False
|
||||||
|
self.thread_checker = None
|
||||||
|
|
||||||
self.stat_recv = defaultdict(lambda: defaultdict(int))
|
self.stat_recv = defaultdict(lambda: defaultdict(int))
|
||||||
self.stat_sent = defaultdict(lambda: defaultdict(int))
|
self.stat_sent = defaultdict(lambda: defaultdict(int))
|
||||||
|
@ -111,11 +112,14 @@ class ConnectionServer(object):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.info("StreamServer listen error: %s" % err)
|
self.log.info("StreamServer listen error: %s" % err)
|
||||||
return False
|
return False
|
||||||
|
self.log.debug("Stopped.")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.log.debug("Stopping")
|
self.log.debug("Stopping %s" % self.stream_server)
|
||||||
self.stopping = True
|
self.stopping = True
|
||||||
self.running = False
|
self.running = False
|
||||||
|
if self.thread_checker:
|
||||||
|
gevent.kill(self.thread_checker)
|
||||||
if self.stream_server:
|
if self.stream_server:
|
||||||
self.stream_server.stop()
|
self.stream_server.stop()
|
||||||
|
|
||||||
|
@ -244,9 +248,9 @@ class ConnectionServer(object):
|
||||||
|
|
||||||
def checkConnections(self):
|
def checkConnections(self):
|
||||||
run_i = 0
|
run_i = 0
|
||||||
|
time.sleep(15)
|
||||||
while self.running:
|
while self.running:
|
||||||
run_i += 1
|
run_i += 1
|
||||||
time.sleep(15) # Check every minute
|
|
||||||
self.ip_incoming = {} # Reset connected ips counter
|
self.ip_incoming = {} # Reset connected ips counter
|
||||||
last_message_time = 0
|
last_message_time = 0
|
||||||
s = time.time()
|
s = time.time()
|
||||||
|
@ -323,6 +327,8 @@ class ConnectionServer(object):
|
||||||
|
|
||||||
if time.time() - s > 0.01:
|
if time.time() - s > 0.01:
|
||||||
self.log.debug("Connection cleanup in %.3fs" % (time.time() - s))
|
self.log.debug("Connection cleanup in %.3fs" % (time.time() - s))
|
||||||
|
|
||||||
|
time.sleep(15)
|
||||||
self.log.debug("Checkconnections ended")
|
self.log.debug("Checkconnections ended")
|
||||||
|
|
||||||
@util.Noparallel(blocking=False)
|
@util.Noparallel(blocking=False)
|
||||||
|
|
Loading…
Reference in a new issue