mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 05:13:58 -07:00
Return error 503 if RethinkDB is down when built as RethinkDB-based controller.
This commit is contained in:
parent
37ae3b2b80
commit
f94aea8119
6 changed files with 20 additions and 12 deletions
|
@ -263,9 +263,13 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,co
|
|||
std::unique_ptr<R::Connection> rdb;
|
||||
while (_run == 1) {
|
||||
try {
|
||||
if (!rdb)
|
||||
if (!rdb) {
|
||||
_connected = 0;
|
||||
rdb = R::connect(this->_host,this->_port,this->_auth);
|
||||
}
|
||||
|
||||
if (rdb) {
|
||||
_connected = 1;
|
||||
R::Array batch;
|
||||
R::Object tmpobj;
|
||||
|
||||
|
@ -434,6 +438,11 @@ bool RethinkDB::waitForReady()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RethinkDB::isReady()
|
||||
{
|
||||
return ((_ready)&&(_connected));
|
||||
}
|
||||
|
||||
void RethinkDB::save(nlohmann::json *orig,nlohmann::json &record)
|
||||
{
|
||||
if (!record.is_object()) // sanity check
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue