From 19f4146acaa3cfaa4dd25cf1811d63a06767893f Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 2 Jun 2021 13:46:11 -0700 Subject: [PATCH] make DB::_memberChanged and _networkChanged virtual --- controller/DB.cpp | 2 ++ controller/DB.hpp | 4 ++-- controller/PostgreSQL.hpp | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controller/DB.cpp b/controller/DB.cpp index edfbb16b8..530582149 100644 --- a/controller/DB.cpp +++ b/controller/DB.cpp @@ -197,6 +197,7 @@ void DB::networks(std::set &networks) void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners) { + fprintf(stderr, "DB::_memberChanged\n"); uint64_t memberId = 0; uint64_t networkId = 0; bool isAuth = false; @@ -312,6 +313,7 @@ void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool no void DB::_networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners) { + fprintf(stderr, "DB::_networkChanged\n"); if (networkConfig.is_object()) { const std::string ids = networkConfig["id"]; const uint64_t networkId = Utils::hexStrToU64(ids.c_str()); diff --git a/controller/DB.hpp b/controller/DB.hpp index 8d9e2202c..a2edb9243 100644 --- a/controller/DB.hpp +++ b/controller/DB.hpp @@ -147,8 +147,8 @@ protected: std::mutex lock; }; - void _memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners); - void _networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners); + virtual void _memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners); + virtual void _networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners); void _fillSummaryInfo(const std::shared_ptr<_Network> &nw,NetworkSummaryInfo &info); std::vector _changeListeners; diff --git a/controller/PostgreSQL.hpp b/controller/PostgreSQL.hpp index 689a29bbc..63084f862 100644 --- a/controller/PostgreSQL.hpp +++ b/controller/PostgreSQL.hpp @@ -110,12 +110,14 @@ protected: { inline std::size_t operator()(const std::pair &p) const { return (std::size_t)(p.first ^ p.second); } }; - void _memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners) { + virtual void _memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners) { + fprintf(stderr, "PostgreSQL::_memberChanged\n"); DB::_memberChanged(old, memberConfig, notifyListeners); } - void _networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners) { - DB::_memberChanged(old, networkConfig, notifyListeners); + virtual void _networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners) { + fprintf(stderr, "PostgreSQL::_networkChanged\n"); + DB::_networkChanged(old, networkConfig, notifyListeners); } private: