From 4da5f4e7a44706d6d1b2efef2d9f682ef0e6c94d Mon Sep 17 00:00:00 2001 From: Tom Early Date: Thu, 24 Jan 2019 05:48:54 -0700 Subject: [PATCH] minor improve of ProcessMMDVM --- QnetRelay.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/QnetRelay.cpp b/QnetRelay.cpp index 49fb722..92e66fe 100644 --- a/QnetRelay.cpp +++ b/QnetRelay.cpp @@ -280,8 +280,7 @@ bool CQnetRelay::ProcessGateway(const int len, const unsigned char *raw) bool CQnetRelay::ProcessMMDVM(const int len, const unsigned char *raw) { - static short old_id = 0U; - static short stream_id = 0U; + static short id = 0U; SDSRP dsrp; if (len < 65) ::memcpy(dsrp.title, raw, len); // transfer raw data to SDSRP struct @@ -289,10 +288,12 @@ bool CQnetRelay::ProcessMMDVM(const int len, const unsigned char *raw) if (49==len || 21==len) { // grab the stream id if this is a header if (49 == len) { - stream_id = dsrp.header.id; - if (old_id == stream_id) + if (dsrp.header.id == id) + return false; + id = dsrp.header.id; + } else { + if (dsrp.voice.id != id) return false; - old_id = stream_id; } SDSTR dstr; // destination @@ -306,7 +307,7 @@ bool CQnetRelay::ProcessMMDVM(const int len, const unsigned char *raw) dstr.vpkt.dst_rptr_id = 0x0; dstr.vpkt.snd_rptr_id = 0x1; dstr.vpkt.snd_term_id = ('B'==RPTR_MOD) ? 0x1 : (('C'==RPTR_MOD) ? 0x2 : 0x3); - dstr.vpkt.streamid = stream_id; + dstr.vpkt.streamid = id; if (49 == len) { // header dstr.remaining = 0x30;