From 2e4134656f87a145e76b7fd892f9dd1da35e040a Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 22 Aug 2021 13:12:58 +0100 Subject: [PATCH] Fix bug when options is sent but system does not appear to be logged in --- hblink.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hblink.py b/hblink.py index 034c85b..36a6973 100755 --- a/hblink.py +++ b/hblink.py @@ -616,11 +616,15 @@ class HBSYSTEM(DatagramProtocol): elif _command == RPTO: _peer_id = _data[4:8] if _peer_id in self._peers and self._peers[_peer_id]['SOCKADDR'] == _sockaddr: - _this_peer = self._peers[_peer_id] - _this_peer['OPTIONS'] = _data[8:] - self.send_peer(_peer_id, b''.join([RPTACK, _peer_id])) - logger.info('(%s) Peer %s has sent options %s', self._system, _this_peer['CALLSIGN'], _this_peer['OPTIONS']) - self._CONFIG['SYSTEMS'][self._system]['OPTIONS'] = _this_peer['OPTIONS'].decode() + _this_peer = self._peers[_peer_id] + _this_peer['OPTIONS'] = _data[8:] + self.send_peer(_peer_id, b''.join([RPTACK, _peer_id])) + logger.info('(%s) Peer %s has sent options %s', self._system, _this_peer['CALLSIGN'], _this_peer['OPTIONS']) + self._CONFIG['SYSTEMS'][self._system]['OPTIONS'] = _this_peer['OPTIONS'].decode() + else: + self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) + logger.warning('(%s) Options from Radio ID that is not logged: %s', self._system, int_id(_peer_id)) + elif _command == RPTP: # RPTPing -- peer is pinging us _peer_id = _data[7:11]