MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SendAuthRequest

Method SendAuthRequest

src/network/network_server.cpp:433–455  ·  view source on GitHub ↗

Request the game password. */

Source from the content-addressed store, hash-verified

431
432/** Request the game password. */
433NetworkRecvStatus ServerNetworkGameSocketHandler::SendAuthRequest()
434{
435 Debug(net, 9, "client[{}] SendAuthRequest()", this->client_id);
436
437 /* Invalid packet when status is anything but STATUS_INACTIVE or STATUS_AUTH_GAME. */
438 if (this->status != STATUS_INACTIVE && status != STATUS_AUTH_GAME) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET);
439
440 Debug(net, 9, "client[{}] status = AUTH_GAME", this->client_id);
441 this->status = STATUS_AUTH_GAME;
442
443 /* Reset 'lag' counters */
444 this->last_frame = this->last_frame_server = _frame_counter;
445
446 if (this->authentication_handler == nullptr) {
447 this->authentication_handler = NetworkAuthenticationServerHandler::Create(&_password_provider, &_authorized_key_handler);
448 }
449
450 auto p = std::make_unique<Packet>(this, PACKET_SERVER_AUTH_REQUEST);
451 this->authentication_handler->SendRequest(*p);
452
453 this->SendPacket(std::move(p));
454 return NETWORK_RECV_STATUS_OKAY;
455}
456
457/** Notify the client that the authentication has completed and tell that for the remainder of this socket encryption is enabled. */
458NetworkRecvStatus ServerNetworkGameSocketHandler::SendEnableEncryption()

Callers 2

Receive_CLIENT_JOINMethod · 0.95

Calls 3

CloseConnectionMethod · 0.95
SendRequestMethod · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected