mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-22 06:14:02 -07:00
Change this back.
Wasn't doing what I thought it was there. Still keeping the erase iterator change
This commit is contained in:
parent
fbeae3c468
commit
d0a7ae4907
1 changed files with 28 additions and 30 deletions
|
@ -1769,9 +1769,6 @@ void EmbeddedNetworkController::_startThreads()
|
||||||
nlohmann::json network, member;
|
nlohmann::json network, member;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
expired.clear();
|
expired.clear();
|
||||||
network.clear();
|
|
||||||
member.clear();
|
|
||||||
|
|
||||||
_RQEntry *qe = (_RQEntry *)0;
|
_RQEntry *qe = (_RQEntry *)0;
|
||||||
Metrics::network_config_request_queue_size = _queue.size();
|
Metrics::network_config_request_queue_size = _queue.size();
|
||||||
auto timedWaitResult = _queue.get(qe, 1000);
|
auto timedWaitResult = _queue.get(qe, 1000);
|
||||||
|
@ -1781,9 +1778,16 @@ void EmbeddedNetworkController::_startThreads()
|
||||||
if (qe) {
|
if (qe) {
|
||||||
try {
|
try {
|
||||||
_request(qe->nwid,qe->fromAddr,qe->requestPacketId,qe->identity,qe->metaData);
|
_request(qe->nwid,qe->fromAddr,qe->requestPacketId,qe->identity,qe->metaData);
|
||||||
if (_db.get(qe->nwid, network, qe->identity.address().toInt(), member)) {
|
} catch (std::exception &e) {
|
||||||
bool networkSSOEnabled = OSUtils::jsonBool(network["ssoEnabled"], false);
|
fprintf(stderr,"ERROR: exception in controller request handling thread: %s" ZT_EOL_S,e.what());
|
||||||
if (networkSSOEnabled) {
|
} catch ( ... ) {
|
||||||
|
fprintf(stderr,"ERROR: exception in controller request handling thread: unknown exception" ZT_EOL_S);
|
||||||
|
}
|
||||||
|
delete qe;
|
||||||
|
qe = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int64_t now = OSUtils::now();
|
int64_t now = OSUtils::now();
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l(_expiringSoon_l);
|
std::lock_guard<std::mutex> l(_expiringSoon_l);
|
||||||
|
@ -1791,10 +1795,15 @@ void EmbeddedNetworkController::_startThreads()
|
||||||
Metrics::sso_expiration_checks++;
|
Metrics::sso_expiration_checks++;
|
||||||
const int64_t when = s->first;
|
const int64_t when = s->first;
|
||||||
if (when <= now) {
|
if (when <= now) {
|
||||||
|
// The user may have re-authorized, so we must actually look it up and check.
|
||||||
|
network.clear();
|
||||||
|
member.clear();
|
||||||
|
if (_db.get(s->second.networkId, network, s->second.nodeId, member)) {
|
||||||
int64_t authenticationExpiryTime = (int64_t)OSUtils::jsonInt(member["authenticationExpiryTime"], 0);
|
int64_t authenticationExpiryTime = (int64_t)OSUtils::jsonInt(member["authenticationExpiryTime"], 0);
|
||||||
if (authenticationExpiryTime <= now) {
|
if (authenticationExpiryTime <= now) {
|
||||||
expired.push_back(s->second);
|
expired.push_back(s->second);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s = _expiringSoon.erase(s);
|
s = _expiringSoon.erase(s);
|
||||||
} else {
|
} else {
|
||||||
// Don't bother going further into the future than necessary.
|
// Don't bother going further into the future than necessary.
|
||||||
|
@ -1807,17 +1816,6 @@ void EmbeddedNetworkController::_startThreads()
|
||||||
onNetworkMemberDeauthorize(nullptr, e->networkId, e->nodeId);
|
onNetworkMemberDeauthorize(nullptr, e->networkId, e->nodeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (std::exception &e) {
|
|
||||||
fprintf(stderr,"ERROR: exception in controller request handling thread: %s" ZT_EOL_S,e.what());
|
|
||||||
} catch ( ... ) {
|
|
||||||
fprintf(stderr,"ERROR: exception in controller request handling thread: unknown exception" ZT_EOL_S);
|
|
||||||
}
|
|
||||||
delete qe;
|
|
||||||
qe = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue