Change in python/osmo-python-tests[master]: osmo_ctrl.py: properly ignore out-of-order traps

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Nov 28 12:00:54 UTC 2018


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/11909 )

Change subject: osmo_ctrl.py: properly ignore out-of-order traps
......................................................................

osmo_ctrl.py: properly ignore out-of-order traps

Sometimes when we set variable we might receive arbitrary number of TRAP
messages before we get SET_REPLY. Those could be either separate
messages or combined together with SET_REPLY depending on tcp buffering
at server side. Let's handle this gracefully by skipping over all TRAP
messages.

An example command which often triggers this behavior:
./osmo_ctrl.py -s -d 127.0.0.1 -p 4249 bts.0.location (date +%s)",fix2d,1,2,3"

Change-Id: Ia6de02c2f13a56f0381c97a9ab02c6c7a31cc32f
Related: SYS#4399
---
M scripts/osmo_ctrl.py
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved
  Neels Hofmeyr: Looks good to me, but someone else must approve



diff --git a/scripts/osmo_ctrl.py b/scripts/osmo_ctrl.py
index 2fb1765..8a67fd8 100755
--- a/scripts/osmo_ctrl.py
+++ b/scripts/osmo_ctrl.py
@@ -41,7 +41,13 @@
         _leftovers(sck, socket.MSG_DONTWAIT)
         (r, c) = Ctrl().cmd(var, value)
         sck.send(c)
-        ret = sck.recv(4096)
+        while True:
+                ret = sck.recv(4096)
+                # handle multiple messages, ignore TRAPs
+                ret = Ctrl().skip_traps(ret)
+                if ret != None:
+                    (i, k, v) = Ctrl().parse(ret)
+                    break;
         return (Ctrl().rem_header(ret),) + Ctrl().verify(ret, r, var, value)
 
 def set_var(sck, var, val):

-- 
To view, visit https://gerrit.osmocom.org/11909
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6de02c2f13a56f0381c97a9ab02c6c7a31cc32f
Gerrit-Change-Number: 11909
Gerrit-PatchSet: 5
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181128/6bae50d2/attachment.htm>


More information about the gerrit-log mailing list