fix ReadSocketWithTimeout to use dedicated io context polled on a new jthread

jthread so it's cancellable
This commit is contained in:
Lion Kortlepel
2026-04-09 18:54:21 +02:00
parent a3cfe47e78
commit 1f55c35f2b
2 changed files with 118 additions and 68 deletions
+14
View File
@@ -28,6 +28,19 @@
struct TConnection;
class TIoPollThread {
public:
TIoPollThread();
~TIoPollThread();
boost::asio::io_context& IoCtx() noexcept { return mIoCtx; }
private:
boost::asio::io_context mIoCtx;
boost::asio::executor_work_guard<boost::asio::io_context::executor_type> mWorkGuard;
std::jthread mThread;
};
class TNetwork {
public:
TNetwork(TServer& Server, TPPSMonitor& PPSMonitor, TResourceManager& ResourceManager);
@@ -63,6 +76,7 @@ private:
std::thread mUDPThread;
std::thread mTCPThread;
std::mutex mOpenIDMutex;
TIoPollThread mIoCtxPoller;
TConnectionLimiter mConnectionLimiter;
std::vector<uint8_t> UDPRcvFromClient(boost::asio::ip::udp::endpoint& ClientEndpoint);