#ifndef STEAM_MESSAGE_HANDLER_H #define STEAM_MESSAGE_HANDLER_H #include #include #include #include #include #include #include #include "../net/tcp_server.h" #include "../net/multiplex_manager.h" class SteamMessageHandler { public: SteamMessageHandler(boost::asio::io_context& io_context, ISteamNetworkingSockets* interface, std::vector& connections, std::mutex& connectionsMutex, bool& g_isHost, int& localPort); ~SteamMessageHandler(); void start(); void stop(); std::shared_ptr getMultiplexManager(HSteamNetConnection conn); private: void startAsyncPoll(); boost::asio::io_context& io_context_; ISteamNetworkingSockets* m_pInterface_; std::vector& connections_; std::mutex& connectionsMutex_; bool& g_isHost_; int& localPort_; std::map> multiplexManagers_; std::unique_ptr timer_; bool running_; int currentPollInterval_; // 当前轮询间隔(毫秒) }; #endif // STEAM_MESSAGE_HANDLER_H