#pragma once #include #include #include #include #include #include namespace blitz { namespace network { class EnetServer : private NonCopyable { public: EnetServer(std::uint16_t port); ~EnetServer(); void Destroy(); void CloseConnection(std::uint16_t a_PeerId); EnetConnection* GetConnection(std::uint16_t a_PeerId); NazaraSignal(OnClientConnect, EnetConnection& /*a_Peer*/); NazaraSignal(OnClientDisconnect, EnetConnection& /*a_Peer*/); NazaraSignal(OnClientDisconnectTimeout, EnetConnection& /*a_Peer*/); private: void Update(); void WorkerThread(); void RemoveConnection(std::uint16_t a_PeerId); Nz::ENetHost m_Host; bool m_Running; std::jthread m_Thread; std::map> m_Connections; }; } // namespace network } // namespace blitz