From 51a5471e59d6b14c2286c5c4fceae5c5cf707e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 17 Oct 2023 21:24:30 -0400 Subject: [PATCH] ConnectionManager: send beacon on io pool Avoids blocking on socket write sequentially, and prevents locking while blocked on a write. Change-Id: Ia9e6e0f3e0d73e070f90d988f351d782932a1a07 --- src/connectionmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ ConnectionManager::connectivityChanged() 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(); }); } } -- GitLab