From 4b9f775f89bf6ce1395c0015fa70fa4845247e71 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 8 Jun 2020 10:57:58 -0700 Subject: [PATCH] don't block headerless streams in qnmodem && allow no irchost --- QnetGateway.cpp | 6 +++--- QnetModem.cpp | 57 ++++++++++++++++++++++--------------------------- QnetModem.h | 1 - 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 8153edc..23bb903 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -54,7 +54,7 @@ #define CFG_DIR "/usr/local/etc" #endif -const std::string GW_VERSION("QnetGateway-603"); +const std::string GW_VERSION("QnetGateway-608"); int CQnetGateway::FindIndex(const int i) const { @@ -203,7 +203,7 @@ bool CQnetGateway::ReadConfig(char *cfgFile) cfg.GetValue(p+"port", estr, ircddb[i].port, 1000, 65535); cfg.GetValue(p+"password", estr, IRCDDB_PASSWORD[i], 0, 512); } - if (0 == ircddb[0].ip.compare(ircddb[1].ip)) { + if ((ircddb[0].ip.size()+ircddb[1].ip.size() > 0) && (0 == ircddb[0].ip.compare(ircddb[1].ip))) { fprintf(stderr, "IRC networks must be different\n"); return true; } @@ -1920,7 +1920,7 @@ void CQnetGateway::Process() aprs_future.get(); } for (int i=0; i<2; i++) { - if (ii[i]) + if (ii[i] && irc_data_future[i].valid()) irc_data_future[i].get(); } } diff --git a/QnetModem.cpp b/QnetModem.cpp index af38b5d..78fe74f 100644 --- a/QnetModem.cpp +++ b/QnetModem.cpp @@ -44,7 +44,7 @@ #include "QnetModem.h" #include "QnetConfigure.h" -#define MODEM_VERSION "QnetModem-526" +#define MODEM_VERSION "QnetModem-608" #define MAX_RESPONSES 30 const unsigned char FRAME_START = 0xE0U; @@ -68,7 +68,6 @@ const unsigned char TYPE_NACK = 0x7FU; CQnetModem::CQnetModem(int mod) : assigned_module(mod) , dstarSpace(0U) -, g2_is_active(false) { } @@ -583,42 +582,38 @@ void CQnetModem::ProcessGateway(const SDSVT &dsvt) memcpy(frame.header.pfcs, dsvt.hdr.pfcs, 2); queue.push(CFrame(&frame.start)); PacketWait.start(); - g2_is_active = true; if (LOG_QSO) printf("Queued to %s flags=%02x:%02x:%02x ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s\n", MODEM_DEVICE.c_str(), frame.header.flag[0], frame.header.flag[1], frame.header.flag[2], frame.header.ur, frame.header.r2, frame.header.r1, frame.header.my, frame.header.nm); } else { // write a voice data packet - if (g2_is_active) { - //const unsigned char sdsync[3] = { 0x55U, 0x2DU, 0x16U }; - if (dsvt.ctrl & 0x40U) { - if (LOG_DEBUG && superframe.size()) - printf("Final order: %s\n", superframe.c_str()); - frame.length = 3U; - frame.type = TYPE_EOT; - g2_is_active = false; - if (LOG_QSO) - printf("Queued modem end of transmission\n"); - } else { - frame.length = 15U; - frame.type = TYPE_DATA; - memcpy(frame.voice.ambe, dsvt.vasd.voice, 12); - if (LOG_DEBUG) { - const unsigned int ctrl = dsvt.ctrl & 0x3FU; - if (VoicePacketIsSync(dsvt.vasd.text)) { - if (superframe.size() > 65) { - printf("Frame order: %s\n", superframe.c_str()); - superframe.clear(); - } - const char *ch = "#abcdefghijklmnopqrstuvwxyz"; - superframe.append(1, (ctrl<27U) ? ch[ctrl] : '%'); - } else { - const char *ch = "!ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - superframe.append(1, (ctrl<27U) ? ch[ctrl] : '*'); + //const unsigned char sdsync[3] = { 0x55U, 0x2DU, 0x16U }; + if (dsvt.ctrl & 0x40U) { + if (LOG_DEBUG && superframe.size()) + printf("Final order: %s\n", superframe.c_str()); + frame.length = 3U; + frame.type = TYPE_EOT; + if (LOG_QSO) + printf("Queued modem end of transmission\n"); + } else { + frame.length = 15U; + frame.type = TYPE_DATA; + memcpy(frame.voice.ambe, dsvt.vasd.voice, 12); + if (LOG_DEBUG) { + const unsigned int ctrl = dsvt.ctrl & 0x3FU; + if (VoicePacketIsSync(dsvt.vasd.text)) { + if (superframe.size() > 65) { + printf("Frame order: %s\n", superframe.c_str()); + superframe.clear(); } + const char *ch = "#abcdefghijklmnopqrstuvwxyz"; + superframe.append(1, (ctrl<27U) ? ch[ctrl] : '%'); + } else { + const char *ch = "!ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + superframe.append(1, (ctrl<27U) ? ch[ctrl] : '*'); } } - queue.push(CFrame(&frame.start)); - PacketWait.start(); } + queue.push(CFrame(&frame.start)); + PacketWait.start(); } } diff --git a/QnetModem.h b/QnetModem.h index 7489973..a923681 100644 --- a/QnetModem.h +++ b/QnetModem.h @@ -190,7 +190,6 @@ public: private: int assigned_module; unsigned int dstarSpace; - bool g2_is_active; // functions bool VoicePacketIsSync(const unsigned char *);