MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / TickServer

Method TickServer

src/openrct2/network/NetworkBase.cpp:541–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

GetTicksFunction · 0.85
disconnectMethod · 0.80
isValidMethod · 0.45
updateMethod · 0.45
AcceptMethod · 0.45

Tested by

no test coverage detected