| 89 | } |
| 90 | |
| 91 | void NetworkServer::createNewClient(std::unique_ptr<NetworkConnection> conn, const ConnectPacket& packet) |
| 92 | { |
| 93 | auto newClient = std::make_unique<Client>(); |
| 94 | newClient->id = _nextClientId++; |
| 95 | newClient->connection = std::move(conn); |
| 96 | newClient->name = Utility::nullTerminatedView(packet.name); |
| 97 | _clients.push_back(std::move(newClient)); |
| 98 | |
| 99 | auto& newClientPtr = *_clients.back(); |
| 100 | |
| 101 | ConnectResponsePacket response; |
| 102 | response.result = ConnectionResult::success; |
| 103 | newClientPtr.connection->sendPacket(response); |
| 104 | |
| 105 | Logging::info("Accepted new client: {}", newClientPtr.name); |
| 106 | } |
| 107 | |
| 108 | void NetworkServer::onReceivePacket(IUdpSocket& socket, std::unique_ptr<INetworkEndpoint> endpoint, const Packet& packet) |
| 109 | { |
nothing calls this directly
no test coverage detected