Skip to content

Commit 6d8c1da

Browse files
committed
tools: gateway: handle positive error codes
Any non-zero response from the connect RPC is an error, not just negative values. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 9664447 commit 6d8c1da

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/infuse_iot/tools/gateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def handle(self, pkt: PacketReceived):
114114
infuse_id = self._ddb.infuse_id_from_bluetooth(if_addr)
115115
if infuse_id is None:
116116
Console.log_error(f"Infuse ID of {if_addr} not known")
117-
else:
117+
elif header.return_code == 0:
118118
self._ddb.observe_security_state(
119119
infuse_id,
120120
bytes(resp.cloud_public_key),
@@ -369,7 +369,7 @@ def _bt_connect_cb(self, pkt: PacketReceived, rc: int, response: bytes):
369369
assert infuse_id is not None, "ID was required to initiate connection?"
370370
assert self._common.server is not None
371371

372-
if rc < 0:
372+
if rc != 0:
373373
rsp = ClientNotificationConnectionFailed(infuse_id)
374374
self._common.notification_broadcast(rsp)
375375
return

0 commit comments

Comments
 (0)