dhtrunner: log warning if calling run() while already running

This commit is contained in:
Adrien Béraud committed 2021-04-16 15:54:45 -04:00
1 parent 40fdd04cb3
commit 4dc7a5ca0a
1 file changed
+4 -1
+4 -1
View File
@@ -104,8 +104,11 @@ DhtRunner::run(const Config& config, Context&& context)
{
std::lock_guard<std::mutex> lck(dht_mtx);
auto expected = State::Idle;
if (not running.compare_exchange_strong(expected, State::Running))
if (not running.compare_exchange_strong(expected, State::Running)) {
if (context.logger)
context.logger->w("[runner %p] Node is already running. Call join() first before calling run() again.");
return;
}
auto local4 = config.bind4;
auto local6 = config.bind6;