From: Otto Moerbeek Date: Wed, 28 Sep 2022 11:38:11 +0000 (+0200) Subject: Mark a few methods non-const, to allow the guard to not be mutable, as suggested... X-Git-Tag: rec-4.9.0-alpha0~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e73e21d6c2d481b80c5234c2fe7432374bdcd661;p=thirdparty%2Fpdns.git Mark a few methods non-const, to allow the guard to not be mutable, as suggested by @rgacogne --- diff --git a/pdns/fstrm_logger.hh b/pdns/fstrm_logger.hh index c2187602a3..7147a471c0 100644 --- a/pdns/fstrm_logger.hh +++ b/pdns/fstrm_logger.hh @@ -49,12 +49,12 @@ public: { return "dnstap"; } - std::string toString() const override + std::string toString() override { return "FrameStreamLogger to " + d_address + " (" + std::to_string(d_framesSent) + " frames sent, " + std::to_string(d_queueFullDrops) + " dropped, " + std::to_string(d_permanentFailures) + " permanent failures)"; } - RemoteLoggerInterface::Stats getStats() const override + RemoteLoggerInterface::Stats getStats() override { return Stats{.d_queued = d_framesSent, .d_pipeFull = d_queueFullDrops, diff --git a/pdns/remote_logger.hh b/pdns/remote_logger.hh index 1b126b403c..058b0c6c96 100644 --- a/pdns/remote_logger.hh +++ b/pdns/remote_logger.hh @@ -67,7 +67,7 @@ public: virtual ~RemoteLoggerInterface() {}; virtual Result queueData(const std::string& data) = 0; virtual std::string address() const = 0; - virtual std::string toString() const = 0; + virtual std::string toString() = 0; virtual const std::string name() const = 0; bool logQueries(void) const { return d_logQueries; } bool logResponses(void) const { return d_logResponses; } @@ -91,7 +91,7 @@ public: } }; - virtual Stats getStats() const = 0; + virtual Stats getStats() = 0; private: bool d_logQueries{true}; @@ -122,13 +122,13 @@ public: { return "protobuf"; } - std::string toString() const override + std::string toString() override { auto runtime = d_runtime.lock(); return d_remote.toStringWithPort() + " (" + std::to_string(runtime->d_stats.d_queued) + " processed, " + std::to_string(runtime->d_stats.d_pipeFull + runtime->d_stats.d_tooLarge + runtime->d_stats.d_otherError) + " dropped)"; } - virtual RemoteLoggerInterface::Stats getStats() const override + virtual RemoteLoggerInterface::Stats getStats() override { return d_runtime.lock()->d_stats; } @@ -155,7 +155,7 @@ private: std::atomic d_exiting{false}; bool d_asyncConnect{false}; - mutable LockGuarded d_runtime; + LockGuarded d_runtime; std::thread d_thread; };