1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Do not accept connections into ongoing game

This commit is contained in:
Ivan Savenko
2023-12-26 16:29:06 +02:00
parent 5694777a96
commit c9765a52ff
3 changed files with 13 additions and 7 deletions

View File

@@ -16,7 +16,6 @@ VCMI_LIB_NAMESPACE_BEGIN
NetworkServer::NetworkServer(INetworkServerListener & listener)
:listener(listener)
{
}
void NetworkServer::start(uint16_t port)
@@ -63,6 +62,12 @@ void NetworkServer::sendPacket(const std::shared_ptr<NetworkConnection> & connec
connection->sendPacket(message);
}
void NetworkServer::closeConnection(const std::shared_ptr<NetworkConnection> & connection)
{
assert(connections.count(connection));
connections.erase(connection);
}
void NetworkServer::onDisconnected(const std::shared_ptr<NetworkConnection> & connection)
{
assert(connections.count(connection));