From 01055000b15ba7585bad48bed96e0cb135939239 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sun, 21 Apr 2019 20:04:09 -0700 Subject: [PATCH] rewrote IDRT_PING handler --- .gitignore | 1 + QnetGateway.cpp | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index da002d9..b52d830 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.o *.d *.gch +.vscode qn.cfg qndtmf gwys.txt diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 7e985a3..5e9411c 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -515,18 +515,21 @@ void CQnetGateway::GetIRCDataThread() if (! rptr.empty()) { pthread_mutex_lock(&irc_data_mutex); auto git = rptr2gwy_map.find(rptr); - if (rptr2gwy_map.end() == git) - break; - gateway = git->second; - printf("IDRT_PING gway=%s\n", gateway.c_str()); - auto ait = gwy2ip_map.find(gateway); - if (gwy2ip_map.end() != ait) - break; - ipaddr = ait->second; - printf("IDRT_PING ip=%s\n", ipaddr.c_str()); + if (rptr2gwy_map.end() != git) { + gateway = git->second; + auto ait = gwy2ip_map.find(gateway); + if (gwy2ip_map.end() != ait) { + ipaddr = ait->second; + CSockAddress to(af_family, (unsigned short)g2_external.port, ipaddr.c_str()); + sendto(g2_sock, "PONG", 4, 0, to.GetPointer(), to.GetSize()); + printf("Sent 'PONG' to %s\n", ipaddr.c_str()); + } else { + printf("Can't find gateway %s in gwy2ip_map\n", gateway.c_str()); + } + } else { + printf("Can't find repeater %s in rptr2gwy_map\n", rptr.c_str()); + } pthread_mutex_unlock(&irc_data_mutex); - CSockAddress to(af_family, (unsigned short)g2_external.port, ipaddr.c_str()); - sendto(g2_sock, "PONG", 4, 0, to.GetPointer(), to.GetSize()); } break; default: