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

jthread so it's cancellable
This commit is contained in:
Lion Kortlepel committed 2026-04-19 18:17:53 +00:00
1 parent a3cfe47e78
commit 1f55c35f2b
2 files changed
+118 -68

No files matched your search

+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);