Change in python/osmo-python-tests[master]: ctrl: cosmetic cleanup

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 11:38:47 UTC 2018


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

Change subject: ctrl: cosmetic cleanup
......................................................................

ctrl: cosmetic cleanup

* remove unused function
* move internal function call outside of main

Change-Id: I3c1bf59775f08f6252d731de653ee9cc212b31da
---
M scripts/osmo_ctrl.py
1 file changed, 1 insertion(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, approved



diff --git a/scripts/osmo_ctrl.py b/scripts/osmo_ctrl.py
index ac20050..2fb1765 100755
--- a/scripts/osmo_ctrl.py
+++ b/scripts/osmo_ctrl.py
@@ -38,6 +38,7 @@
         return sck
 
 def do_set_get(sck, var, value = None):
+        _leftovers(sck, socket.MSG_DONTWAIT)
         (r, c) = Ctrl().cmd(var, value)
         sck.send(c)
         ret = sck.recv(4096)
@@ -47,10 +48,6 @@
         (a, _, _) = do_set_get(sck, var, val)
         return a
 
-def get_var(sck, var):
-        (_, _, v) = do_set_get(sck, var)
-        return v
-
 def _leftovers(sck, fl):
         """
         Read outstanding data if any according to flags
@@ -102,13 +99,11 @@
         if options.cmd_set:
                 if len(args) < 2:
                         parser.error("Set requires var and value arguments")
-                _leftovers(sock, socket.MSG_DONTWAIT)
                 print("Got message:", set_var(sock, args[0], ' '.join(args[1:])))
 
         if options.cmd_get:
                 if len(args) != 1:
                         parser.error("Get requires the var argument")
-                _leftovers(sock, socket.MSG_DONTWAIT)
                 (a, _, _) = do_set_get(sock, args[0])
                 print("Got message:", a)
 

-- 
To view, visit https://gerrit.osmocom.org/11930
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: I3c1bf59775f08f6252d731de653ee9cc212b31da
Gerrit-Change-Number: 11930
Gerrit-PatchSet: 4
Gerrit-Owner: Max <msuraev at sysmocom.de>
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/36a7c220/attachment.htm>


More information about the gerrit-log mailing list