ConnectionManager: send beacon on io pool
Avoids blocking on socket write sequentially,
and prevents locking while blocked on a write.
Change-Id: Ia9e6e0f3e0d73e070f90d988f351d782932a1a07
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 9e139bc..68f40b1 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1963,7 +1963,7 @@
for (const auto& ci : pimpl_->infos_.getConnectedInfos()) {
std::lock_guard<std::mutex> lk(ci->mutex_);
if (ci->socket_)
- ci->socket_->sendBeacon();
+ dht::ThreadPool::io().run([s = ci->socket_] { s->sendBeacon(); });
}
}