From: Charles-Henri Bruyand Date: Thu, 13 Dec 2018 15:48:06 +0000 (+0100) Subject: auth: lua-records - get rid of getStatus(), avoid object leak and align var type... X-Git-Tag: rec-4.2.0-alpha1~49^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df6ad4eec135dbb35b9821a224d48db898f7b819;p=thirdparty%2Fpdns.git auth: lua-records - get rid of getStatus(), avoid object leak and align var type to format string --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index cad20bd556..03e0b53345 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -69,7 +69,7 @@ private: struct Checker { - std::thread* thr; + std::thread thr; bool status; }; @@ -113,13 +113,6 @@ private: std::lock_guard l(d_mutex); return d_statuses[cd].status; } - - statuses_t getStatus() - { - std::lock_guard l(d_mutex); - return d_statuses; - } - }; bool IsUpOracle::isUp(const CheckDesc& cd) @@ -127,8 +120,7 @@ bool IsUpOracle::isUp(const CheckDesc& cd) std::lock_guard l(d_mutex); auto iter = d_statuses.find(cd); if(iter == d_statuses.end()) { - std::thread* checker = new std::thread(&IsUpOracle::checkTCPThread, this, cd.rem, cd.opts); - d_statuses[cd]=Checker{checker, false}; + d_statuses[cd]=Checker{std::thread(&IsUpOracle::checkTCPThread, this, cd.rem, cd.opts), false}; return false; } return iter->second.status; @@ -148,8 +140,7 @@ bool IsUpOracle::isUp(const ComboAddress& remote, const std::string& url, const auto iter = d_statuses.find(cd); if(iter == d_statuses.end()) { // g_log<> luaSynth(const std::string& code, cons if(parts.size()==1) { // either hex string, or 12-13-14-15 // cout<