From: Ondrej Lichtner <olichtne(a)redhat.com>
The get_messages method of the ServerHandler class will now return
messages sorted so that messages from the controller are last. This
presents a kind of optimization resulting in updates taking place before
the controller calls a method.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 0cd6185..d334449 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -392,6 +392,18 @@ class ServerHandler(object):
def get_messages(self):
messages = self._connection_handler.check_connections()
+
+ #push ctl messages to the end of message queue, this ensures that
+ #update messages are handled first
+ ctl_msgs = []
+ non_ctl_msgs = []
+ for msg in messages:
+ if msg[0] == self._c_socket[1]:
+ ctl_msgs.append(msg)
+ else:
+ non_ctl_msgs.append(msg)
+ messages = non_ctl_msgs + ctl_msgs
+
addr = self._c_socket[1]
if self._connection_handler.get_connection(addr) == None:
logging.info("Lost controller connection.")
--
1.8.5.3