mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-22 14:22:23 +00:00
Member commit bug fix.
This commit is contained in:
parent
249c27afd5
commit
e4a10cc510
@ -43,9 +43,9 @@ static const char *_timestr()
|
|||||||
{
|
{
|
||||||
time_t t = time(0);
|
time_t t = time(0);
|
||||||
char *ts = ctime(&t);
|
char *ts = ctime(&t);
|
||||||
if (!ts)
|
|
||||||
return "error";
|
|
||||||
char *p = ts;
|
char *p = ts;
|
||||||
|
if (!p)
|
||||||
|
return "";
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (*p == '\n') {
|
if (*p == '\n') {
|
||||||
*p = (char)0;
|
*p = (char)0;
|
||||||
@ -165,10 +165,10 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,co
|
|||||||
if (!config)
|
if (!config)
|
||||||
continue;
|
continue;
|
||||||
json record;
|
json record;
|
||||||
const std::string objtype = (*config)["objtype"];
|
const char *table = (const char *)0;
|
||||||
const char *table;
|
|
||||||
std::string deleteId;
|
std::string deleteId;
|
||||||
try {
|
try {
|
||||||
|
const std::string objtype = (*config)["objtype"];
|
||||||
if (objtype == "member") {
|
if (objtype == "member") {
|
||||||
const std::string nwid = (*config)["nwid"];
|
const std::string nwid = (*config)["nwid"];
|
||||||
const std::string id = (*config)["id"];
|
const std::string id = (*config)["id"];
|
||||||
@ -196,15 +196,20 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,co
|
|||||||
const std::string tmp = (*config)["id"];
|
const std::string tmp = (*config)["id"];
|
||||||
deleteId.append(tmp);
|
deleteId.append(tmp);
|
||||||
table = "Member";
|
table = "Member";
|
||||||
} else {
|
|
||||||
delete config;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
delete config;
|
} catch (std::exception &e) {
|
||||||
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update record creation): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.what());
|
||||||
|
table = (const char *)0;
|
||||||
|
} catch (R::Error &e) {
|
||||||
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update record creation): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.message.c_str());
|
||||||
|
table = (const char *)0;
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
delete config;
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update record creation): unknown exception" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt());
|
||||||
continue;
|
table = (const char *)0;
|
||||||
}
|
}
|
||||||
|
delete config;
|
||||||
|
if (!table)
|
||||||
|
continue;
|
||||||
|
|
||||||
while (_run == 1) {
|
while (_run == 1) {
|
||||||
try {
|
try {
|
||||||
@ -221,6 +226,7 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,co
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update): connect failed (will retry)" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt());
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update): connect failed (will retry)" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt());
|
||||||
|
rdb.reset();
|
||||||
}
|
}
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.what());
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.what());
|
||||||
@ -235,7 +241,13 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,co
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch ( ... ) {}
|
} catch (std::exception &e) {
|
||||||
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update outer loop): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.what());
|
||||||
|
} catch (R::Error &e) {
|
||||||
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update outer loop): %s" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt(),e.message.c_str());
|
||||||
|
} catch ( ... ) {
|
||||||
|
fprintf(stderr,"[%s] ERROR: %.10llx controller RethinkDB (insert/update outer loop): unknown exception" ZT_EOL_S,_timestr(),(unsigned long long)_myAddress.toInt());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +443,7 @@ void RethinkDB::save(nlohmann::json *orig,nlohmann::json &record)
|
|||||||
if ((kv.key() == "id")||(kv.key() == "nwid")||(kv.key() == "objtype")||((*q)[kv.key()] != kv.value()))
|
if ((kv.key() == "id")||(kv.key() == "nwid")||(kv.key() == "objtype")||((*q)[kv.key()] != kv.value()))
|
||||||
(*q)[kv.key()] = kv.value();
|
(*q)[kv.key()] = kv.value();
|
||||||
}
|
}
|
||||||
|
_commitQueue.post(new nlohmann::json(record));
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
delete q;
|
delete q;
|
||||||
throw;
|
throw;
|
||||||
|
@ -270,7 +270,7 @@ official-static: FORCE
|
|||||||
|
|
||||||
central-controller: FORCE
|
central-controller: FORCE
|
||||||
cd ext/librethinkdbxx ; make
|
cd ext/librethinkdbxx ; make
|
||||||
make LDLIBS="ext/librethinkdbxx/build/librethinkdb++.a" DEFS="-DZT_CONTROLLER_USE_RETHINKDB" one
|
make -j8 LDLIBS="ext/librethinkdbxx/build/librethinkdb++.a" DEFS="-DZT_CONTROLLER_USE_RETHINKDB" one
|
||||||
|
|
||||||
debug: FORCE
|
debug: FORCE
|
||||||
make ZT_DEBUG=1 one
|
make ZT_DEBUG=1 one
|
||||||
|
Loading…
Reference in New Issue
Block a user