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
This commit is contained in:
Neels Hofmeyr 2020-12-06 22:51:13 +01:00
parent 1e01a68846
commit f80f7cc5c4
1 changed files with 3 additions and 3 deletions

View File

@ -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):