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.orgMax has uploaded this change for review. ( 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, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/09/11909/1
diff --git a/scripts/osmo_ctrl.py b/scripts/osmo_ctrl.py
index ac20050..5f5f209 100755
--- a/scripts/osmo_ctrl.py
+++ b/scripts/osmo_ctrl.py
@@ -40,8 +40,17 @@
def do_set_get(sck, var, value = None):
(r, c) = Ctrl().cmd(var, value)
sck.send(c)
- ret = sck.recv(4096)
- return (Ctrl().rem_header(ret),) + Ctrl().verify(ret, r, var, value)
+ tail = sck.recv(4096)
+ while True:
+ # handle multiple messages
+ (head, tail) = Ctrl().split_combined(tail)
+ (i, k, v) = Ctrl().parse(head)
+ # ignore all traps
+ if int(i) != 0:
+ break;
+ if len(tail) == 0:
+ tail = sck.recv(4096)
+ return (Ctrl().rem_header(head),) + Ctrl().verify(head, r, var, value)
def set_var(sck, var, val):
(a, _, _) = do_set_get(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: newchange
Gerrit-Change-Id: Ia6de02c2f13a56f0381c97a9ab02c6c7a31cc32f
Gerrit-Change-Number: 11909
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181123/91051410/attachment.htm>