Send the client a welcome message with some basic information. */
| 470 | |
| 471 | /** Send the client a welcome message with some basic information. */ |
| 472 | NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome() |
| 473 | { |
| 474 | Debug(net, 9, "client[{}] SendWelcome()", this->client_id); |
| 475 | |
| 476 | /* Invalid packet when status is anything but STATUS_NEWGRFS_CHECK. */ |
| 477 | if (this->status != STATUS_NEWGRFS_CHECK) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET); |
| 478 | |
| 479 | Debug(net, 9, "client[{}] status = AUTHORIZED", this->client_id); |
| 480 | this->status = STATUS_AUTHORIZED; |
| 481 | |
| 482 | /* Reset 'lag' counters */ |
| 483 | this->last_frame = this->last_frame_server = _frame_counter; |
| 484 | |
| 485 | _network_game_info.clients_on++; |
| 486 | |
| 487 | auto p = std::make_unique<Packet>(this, PACKET_SERVER_WELCOME); |
| 488 | p->Send_uint32(this->client_id); |
| 489 | this->SendPacket(std::move(p)); |
| 490 | |
| 491 | /* Transmit info about all the active clients */ |
| 492 | for (NetworkClientSocket *new_cs : NetworkClientSocket::Iterate()) { |
| 493 | if (new_cs != this && new_cs->status >= STATUS_AUTHORIZED) { |
| 494 | this->SendClientInfo(new_cs->GetInfo()); |
| 495 | } |
| 496 | } |
| 497 | /* Also send the info of the server */ |
| 498 | return this->SendClientInfo(NetworkClientInfo::GetByClientID(CLIENT_ID_SERVER)); |
| 499 | } |
| 500 | |
| 501 | /** Tell the client that its put in a waiting queue. */ |
| 502 | NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait() |
no test coverage detected