diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 6b143b6..1af1bef 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -54,7 +54,7 @@ #define CFG_DIR "/usr/local/etc" #endif -const std::string GW_VERSION("QnetGateway-200320"); +const std::string GW_VERSION("QnetGateway-326"); static std::atomic keep_running(true); @@ -452,7 +452,7 @@ void CQnetGateway::GetIRCDataThread(const int i) ii[i]->receivePing(rptr); if (! rptr.empty()) { ReplaceChar(rptr, '_', ' '); - cache[i].findRptrData(rptr, gate, addr); + ii[i]->cache.findRptrData(rptr, gate, addr); if (addr.empty()) break; CSockAddress to; @@ -481,7 +481,7 @@ int CQnetGateway::get_yrcall_rptr_from_cache(const int i, const std::string &cal { switch (RoU) { case 'U': - cache[i].findUserData(call, rptr, gate, addr); + ii[i]->cache.findUserData(call, rptr, gate, addr); if (rptr.empty()) { printf("Could not find last heard repeater for user '%s'\n", call.c_str()); return 1; @@ -489,7 +489,7 @@ int CQnetGateway::get_yrcall_rptr_from_cache(const int i, const std::string &cal break; case 'R': rptr.assign(call); - cache[i].findRptrData(call, gate, addr); + ii[i]->cache.findRptrData(call, gate, addr); break; default: fprintf(stderr, "ERROR: Invalid Rou of '%c'\n", RoU); @@ -2340,7 +2340,7 @@ bool CQnetGateway::Init(char *cfgfile) for (int j=0; j<2; j++) { if (ircddb[j].ip.empty()) continue; - ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str(), &cache[j]); + ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str()); bool ok = ii[j]->open(); if (!ok) { printf("%s open failed\n", ircddb[j].ip.c_str()); diff --git a/QnetGateway.h b/QnetGateway.h index 262acfa..ed9fe03 100644 --- a/QnetGateway.h +++ b/QnetGateway.h @@ -25,7 +25,6 @@ #include "aprs.h" #include "SockAddress.h" #include "QnetDB.h" -#include "CacheManager.h" #include "DStarDecode.h" #define MAXHOSTNAMELEN 64 @@ -158,9 +157,6 @@ private: // for bit error rate calcs CDStarDecode decode; - // CACHE used to cache users, repeaters, gateways and addresses - CCacheManager cache[2]; - // dtmf stuff int dtmf_buf_count[3]; char dtmf_buf[3][MAX_DTMF_BUF + 1]; diff --git a/ircddb/IRCDDB.cpp b/ircddb/IRCDDB.cpp index 1e3123a..59e5cb1 100644 --- a/ircddb/IRCDDB.cpp +++ b/ircddb/IRCDDB.cpp @@ -4,14 +4,12 @@ #include "IRCDDBApp.h" #include "IRCutils.h" -CIRCDDB::CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo, CCacheManager *cache) +CIRCDDB::CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo) { - this->cache = cache; - const std::string update_channel("#dstar"); - app = new IRCDDBApp(update_channel, cache); + app = new IRCDDBApp(update_channel, &cache); client = new IRCClient(app, update_channel, hostName, port, callsign, password, versionInfo); } diff --git a/ircddb/IRCDDB.h b/ircddb/IRCDDB.h index 950ac27..57e3a93 100644 --- a/ircddb/IRCDDB.h +++ b/ircddb/IRCDDB.h @@ -21,7 +21,7 @@ class IRCClient; class CIRCDDB { public: - CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo, CCacheManager *cache); + CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo); ~CIRCDDB(); // returns the socket family type @@ -106,8 +106,9 @@ public: void close(); // Implictely kills any threads in the IRC code + CCacheManager cache; + private: IRCDDBApp *app; IRCClient *client; - CCacheManager *cache; };