add close server function

This commit is contained in:
2024-07-23 01:12:12 +02:00
parent ff73cd348e
commit d5d459b658
2 changed files with 8 additions and 0 deletions

View File

@@ -19,6 +19,8 @@ class Server {
void CloseConnection(std::uint16_t a_PeerId);
void CloseServer();
private:
void HandleConnect(network::EnetConnection&);
void HandleDisconnect(network::EnetConnection&);

View File

@@ -73,5 +73,11 @@ void Server::CloseConnection(std::uint16_t a_PeerId) {
m_NetworkServer.CloseConnection(a_PeerId);
}
void Server::CloseServer() {
for (auto& [peerId, session] : m_Sessions) {
CloseConnection(peerId);
}
}
} // namespace server
} // namespace blitz