| 539 | } |
| 540 | |
| 541 | void NetworkBase::TickServer() |
| 542 | { |
| 543 | for (auto& connection : client_connection_list) |
| 544 | { |
| 545 | // This can be called multiple times before the connection is removed. |
| 546 | if (!connection->isValid()) |
| 547 | continue; |
| 548 | |
| 549 | if (!ProcessConnection(*connection)) |
| 550 | { |
| 551 | if (connection->player != nullptr) |
| 552 | LOG_INFO("Disconnecting player %s", connection->player->name.c_str()); |
| 553 | else |
| 554 | LOG_INFO("Disconnecting unknown player"); |
| 555 | connection->disconnect(); |
| 556 | } |
| 557 | else |
| 558 | { |
| 559 | DecayCooldown(connection->player); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | uint32_t ticks = Platform::GetTicks(); |
| 564 | if (ticks > last_ping_sent_time + 3000) |
| 565 | { |
| 566 | ServerSendPing(); |
| 567 | ServerSendPingList(); |
| 568 | } |
| 569 | |
| 570 | if (_advertiser != nullptr) |
| 571 | { |
| 572 | _advertiser->update(); |
| 573 | } |
| 574 | |
| 575 | std::unique_ptr<ITcpSocket> tcpSocket = _listenSocket->Accept(); |
| 576 | if (tcpSocket != nullptr) |
| 577 | { |
| 578 | AddClient(std::move(tcpSocket)); |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | void NetworkBase::UpdateClient() |
| 583 | { |
nothing calls this directly
no test coverage detected