Refactor Steam Networking Components

- Removed SteamMessageHandler class and its implementation files.
- Integrated control packet handling directly into the SteamMessageHandler.
- Updated TCPClient and TCPServer classes to improve connection management and error handling.
- Added SteamNetworkingManager class to manage Steam networking, including lobby creation and connection handling.
- Implemented callbacks for Steam Friends and Matchmaking to handle lobby events.
- Enhanced message forwarding logic between TCP clients and Steam connections.
- Introduced control packet handling for ping responses.
- Improved thread safety with mutexes for shared resources.
This commit is contained in:
Ayndpa
2025-11-18 21:03:01 +08:00
parent 676d39d6a2
commit af181bb133
10 changed files with 547 additions and 281 deletions

View File

@@ -10,18 +10,14 @@
#include <isteamnetworkingutils.h>
#include <steamnetworkingtypes.h>
using boost::asio::ip::tcp;
class SteamNetworkingManager;
// Extern declarations for global variables used in TCPServer
extern HSteamNetConnection g_hConnection;
extern bool g_isConnected;
extern ISteamNetworkingSockets* m_pInterface;
extern bool forwarding;
using boost::asio::ip::tcp;
// TCP Server class
class TCPServer {
public:
TCPServer(int port);
TCPServer(int port, SteamNetworkingManager* manager);
~TCPServer();
bool start();
@@ -43,4 +39,6 @@ private:
std::mutex clientsMutex_;
std::thread serverThread_;
bool hasAcceptedConnection_;
SteamNetworkingManager* manager_;
bool forwarding_;
};