aboutsummaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2016-01-06 12:03:34 +0100
committerMaZderMind <github@mazdermind.de>2016-01-06 12:03:34 +0100
commit48ca2215164c8e792ef78e578e49b93f0f3ce727 (patch)
treec97b636f21d72ad24bbf0dcc3ea118b560f503bc /voctocore
parent3b292cf462bf894119edb726732172eedc6b6903 (diff)
add debugging to de what's going on in the control-server
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/lib/controlserver.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py
index c0ceb0b..bd263ff 100644
--- a/voctocore/lib/controlserver.py
+++ b/voctocore/lib/controlserver.py
@@ -57,7 +57,9 @@ class ControlServer(TCPMultiConnection):
return False
if self.command_queue.empty():
+ self.log.debug('command_queue was empty, re-starting on_loop scheduling')
GObject.idle_add(self.on_loop)
+
self.command_queue.put((line, conn))
if close_after:
@@ -73,12 +75,18 @@ class ControlServer(TCPMultiConnection):
def on_loop(self):
'''Command handler. Processes commands in the command queue whenever
nothing else is happening (registered as GObject idle callback)'''
+
+ self.log.debug('on_loop called')
+
if self.command_queue.empty():
+ self.log.debug('command_queue is empty again, stopping on_loop scheduling')
return False
+
line, requestor = self.command_queue.get()
words = line.split()
if len(words) < 1:
+ self.log.debug('command_queue is empty again, stopping on_loop scheduling')
return False
command = words[0]
@@ -127,13 +135,17 @@ class ControlServer(TCPMultiConnection):
def _schedule_write(self, conn, message):
queue = self.currentConnections[conn]
+
if queue.empty():
+ self.log.debug('write_queue[%u] was empty, re-starting on_write scheduling', conn.fileno())
GObject.io_add_watch(conn, GObject.IO_OUT, self.on_write)
+
queue.put(message)
def on_write(self, conn, *args):
# TODO: on_loop() is not called as soon as there is a writable socket
self.on_loop()
+ self.log.debug('on_write[%u] called', conn.fileno())
try:
queue = self.currentConnections[conn]
@@ -141,6 +153,7 @@ class ControlServer(TCPMultiConnection):
return False
if queue.empty():
+ self.log.debug('write_queue[%u] is empty again, stopping on_write scheduling', conn.fileno())
return False
message = queue.get()