in rpc client, contention on a null lock happened.
fix this by making the sending of pings always done in the logic
thread. this is done by wrapping the lambda we made with EventLoop::make_caller()
This commit is contained in:
Jeff Becker 2023-02-15 16:43:47 -05:00
parent 366d0c1be9
commit d7d3a4e774
No known key found for this signature in database
GPG Key ID: 025C02EE3A092F2D
1 changed files with 9 additions and 3 deletions

View File

@ -171,7 +171,12 @@ namespace llarp
LokidRpcClient::StartPings()
{
constexpr auto PingInterval = 30s;
auto makePingRequest = [self = shared_from_this()]() {
auto router = m_Router.lock();
if (not router)
return;
auto makePingRequest = router->loop()->make_caller([self = shared_from_this()]() {
// send a ping
PubKey pk{};
auto r = self->m_Router.lock();
@ -208,10 +213,11 @@ namespace llarp
// reason (e.g. oxend restarts and loses the subscription); we poll using the last known
// hash so that the poll is very cheap (basically empty) if the block hasn't advanced.
self->UpdateServiceNodeList();
};
});
// Fire one ping off right away to get things going.
makePingRequest();
m_lokiMQ->add_timer(makePingRequest, PingInterval);
m_lokiMQ->add_timer(std::move(makePingRequest), PingInterval);
}
void