From f80f7cc5c46bddf63c0f41042f28e7f62aec45af Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 6 Dec 2020 22:51:13 +0100 Subject: [PATCH] OsmoCtrl: use one global common counter for CTRL IDs It is easier to traverse debugging logs if the CTRL request and response IDs are globally unique across all programs and tests. Before this, we were using 0 almost everywhere. (This is not strictly needed for correctness, since each CTRL client has its own request ID scope; just we open fairly many separate CTRL clients all the time in our tests.) Change-Id: I44c51f4fb5beb6cedf98ea0d6684a24c6aa418c7 --- src/osmo_gsm_tester/obj/osmo_ctrl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osmo_gsm_tester/obj/osmo_ctrl.py b/src/osmo_gsm_tester/obj/osmo_ctrl.py index 6c4ac876..3098960a 100644 --- a/src/osmo_gsm_tester/obj/osmo_ctrl.py +++ b/src/osmo_gsm_tester/obj/osmo_ctrl.py @@ -39,17 +39,17 @@ class CtrlInterfaceExn(Exception): pass class OsmoCtrl(log.Origin): + _next_id = 1 def __init__(self, host, port): super().__init__(log.C_BUS, 'Ctrl', host=host, port=port) self.host = host self.port = port self.sck = None - self._next_id = 0 def next_id(self): - ret = self._next_id - self._next_id += 1 + ret = OsmoCtrl._next_id + OsmoCtrl._next_id += 1 return ret def prefix_ipa_ctrl_header(self, data):