fix race on disconnect

between the time we check for `is_open` and the actual disconnect, the
socket could already have been disconnected by another thread (TOCTOU).
Furthermore, the disconnects can race causing a segfault or similar
issue in the asio's internals.
This commit is contained in:
Lion Kortlepel committed 2026-04-19 18:17:53 +00:00
1 parent e9ce71d39a
commit 7089e5da9a
5 files changed
+29 -9

No files matched your search

+1 -1
View File
@@ -76,7 +76,7 @@ void TPPSMonitor::operator()() {
return true;
});
for (auto& ClientToKick : TimedOutClients) {
ClientToKick->Disconnect("Timeout");
Network().DisconnectClient(*ClientToKick, "Timeout");
}
TimedOutClients.clear();
if (C == 0 || mInternalPPS == 0) {