Skip to content
Snippets Groups Projects
Commit 26ad6de3 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

dhtrunner: avoid race condition when setting token

parent ae91f8bd
Branches
Tags
No related merge requests found
...@@ -672,10 +672,10 @@ DhtRunner::listen(InfoHash hash, ValueCallback vcb, Value::Filter f, Where w) ...@@ -672,10 +672,10 @@ DhtRunner::listen(InfoHash hash, ValueCallback vcb, Value::Filter f, Where w)
} }
return true; return true;
}; };
if (use_proxy) if (auto token = dht.listen(hash, listener.gcb, listener.f, listener.w)) {
listener.tokenProxyDht = dht.listen(hash, listener.gcb, listener.f, listener.w); if (use_proxy) listener.tokenProxyDht = token;
else else listener.tokenClassicDht = token;
listener.tokenClassicDht = dht.listen(hash, listener.gcb, listener.f, listener.w); }
ret_token->set_value(tokenbGlobal); ret_token->set_value(tokenbGlobal);
#else #else
ret_token->set_value(dht.listen(hash, std::move(vcb), std::move(f), std::move(w))); ret_token->set_value(dht.listen(hash, std::move(vcb), std::move(f), std::move(w)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment