aboutsummaryrefslogtreecommitdiffstats
path: root/configd
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-06-11 13:08:42 +0000
committerArne Juul <arnej@verizonmedia.com>2021-06-11 13:08:42 +0000
commite97e12fec351222ff111c066a1dd8c831e436a36 (patch)
tree37d66683631587fbeac9e9770fdb2c1cb38a82b5 /configd
parent6f8792b0acfa3e417d124b519b6383065a6bfd7a (diff)
open up with more APIs
Diffstat (limited to 'configd')
-rw-r--r--configd/src/apps/sentinel/peer-check.cpp8
-rw-r--r--configd/src/apps/sentinel/peer-check.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/configd/src/apps/sentinel/peer-check.cpp b/configd/src/apps/sentinel/peer-check.cpp
index 46196f36bf1..daab80eefc7 100644
--- a/configd/src/apps/sentinel/peer-check.cpp
+++ b/configd/src/apps/sentinel/peer-check.cpp
@@ -15,7 +15,8 @@ PeerCheck::PeerCheck(StatusCallback &callback, const std::string &host, int port
_hostname(host),
_portnum(port),
_target(nullptr),
- _req(nullptr)
+ _req(nullptr),
+ _statusOk(false)
{
auto spec = fmt("tcp/%s:%d", _hostname.c_str(), _portnum);
_target = orb.GetTarget(spec.c_str());
@@ -31,20 +32,19 @@ PeerCheck::~PeerCheck() {
void PeerCheck::RequestDone(FRT_RPCRequest *req) {
LOG_ASSERT(req == _req);
- bool statusOk = false;
if (req->IsError()) {
LOG(debug, "error on ping to %s [port %d]: %s (%d)", _hostname.c_str(), _portnum,
req->GetErrorMessage(), req->GetErrorCode());
} else {
LOG(debug, "OK ping to %s [port %d]", _hostname.c_str(), _portnum);
- statusOk = true;
+ _statusOk = true;
}
_req->SubRef();
_req = nullptr;
_target->SubRef();
_target = nullptr;
// Note: will delete this object, so must be called as final step:
- _callback.returnStatus(statusOk);
+ _callback.returnStatus(_statusOk);
}
}
diff --git a/configd/src/apps/sentinel/peer-check.h b/configd/src/apps/sentinel/peer-check.h
index 096f304467b..ac124106387 100644
--- a/configd/src/apps/sentinel/peer-check.h
+++ b/configd/src/apps/sentinel/peer-check.h
@@ -17,6 +17,9 @@ public:
PeerCheck(StatusCallback &callback, const std::string &host, int portnum, FRT_Supervisor &orb, int timeout_ms);
~PeerCheck();
+ bool okStatus() const { return _statusOk; }
+ const std::string& getHostname() const { return _hostname; }
+
PeerCheck(const PeerCheck &) = delete;
PeerCheck(PeerCheck &&) = delete;
PeerCheck& operator= (const PeerCheck &) = delete;
@@ -30,6 +33,7 @@ private:
int _portnum;
FRT_Target *_target;
FRT_RPCRequest *_req;
+ bool _statusOk;
};
}