From 0b1d1907916093905b6eba9647af680aa6a23983 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Sat, 24 May 2014 14:56:53 -0500 Subject: [PATCH] Fixed MASTER_REG_REPLY peer calc Was previously really messed up, but worked some of the time by some crazy twist of fate. --- dmrlink.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dmrlink.py b/dmrlink.py index 14286ab..5887bfc 100755 --- a/dmrlink.py +++ b/dmrlink.py @@ -654,7 +654,7 @@ class IPSC(DatagramProtocol): self.PEER_ALIVE_REPLY_PKT = (PEER_ALIVE_REPLY + self._local_id + self.TS_FLAGS) # # Master Link Maintenance Packets - self.MASTER_REG_REPLY_PKT = (MASTER_REG_REPLY + self._local_id + self.TS_FLAGS + str(self._local['NUM_PEERS']) + IPSC_VER) + # self.MASTER_REG_REPLY_PKT is not static and must be generated when it is sent self.MASTER_ALIVE_REPLY_PKT = (MASTER_ALIVE_REPLY + self._local_id + self.TS_FLAGS + IPSC_VER) self.PEER_LIST_REPLY_PKT = (PEER_LIST_REPLY + self._local_id) # @@ -1143,6 +1143,8 @@ class IPSC(DatagramProtocol): _decoded_mode = process_mode_byte(_hex_mode) _decoded_flags = process_flags_bytes(_hex_flags) + self.MASTER_REG_REPLY_PKT = (MASTER_REG_REPLY + self._local_id + self.TS_FLAGS + hex_str_2(self._local['NUM_PEERS']) + IPSC_VER + master_reg_reply_packet = self.hashed_packet(self._local['AUTH_KEY'], self.MASTER_REG_REPLY_PKT) self.transport.write(master_reg_reply_packet, (host, port)) logger.debug('(%s) Master Registration Packet Received from peer %s', self._network, int_id(_peerid))