aboutsummaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2016-01-10 11:19:44 +0100
committerMaZderMind <git@mazdermind.de>2016-01-10 11:21:40 +0100
commite07ead79ac6e6897f5c6fa8d84a380ae99b028f8 (patch)
tree9f17fa3c0addd5730edf6b17040104c5295c9efe /voctocore
parentfd5a9c94892e0a890b6e0702c745e50e48f16f23 (diff)
always shedule on_loop/on_write on i/o to actively mitigate race-conditions, fixes #43
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/lib/controlserver.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py
index 2dc6e1c..016d20c 100644
--- a/voctocore/lib/controlserver.py
+++ b/voctocore/lib/controlserver.py
@@ -55,9 +55,8 @@ class ControlServer(TCPMultiConnection):
self.close_connection(conn)
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.log.debug('re-starting on_loop scheduling')
+ GObject.idle_add(self.on_loop)
self.command_queue.put((line, conn))
@@ -135,9 +134,8 @@ 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)
+ self.log.debug('re-starting on_write scheduling', conn.fileno())
+ GObject.io_add_watch(conn, GObject.IO_OUT, self.on_write)
queue.put(message)