MCPcopy Create free account
hub / github.com/ddnet/ddnet / ReconnectClient

Method ReconnectClient

src/engine/server/server.cpp:521–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521void CServer::ReconnectClient(int ClientId)
522{
523 dbg_assert(0 <= ClientId && ClientId < MAX_CLIENTS, "Invalid ClientId: %d", ClientId);
524 dbg_assert(m_aClients[ClientId].m_State != CClient::STATE_EMPTY, "Client slot empty: %d", ClientId);
525
526 if(GetClientVersion(ClientId) < VERSION_DDNET_RECONNECT)
527 {
528 RedirectClient(ClientId, m_NetServer.Address().port);
529 return;
530 }
531 log_info("server", "telling client to reconnect, cid=%d", ClientId);
532
533 CMsgPacker Msg(NETMSG_RECONNECT, true);
534 SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, ClientId);
535
536 if(m_aClients[ClientId].m_State >= CClient::STATE_READY)
537 {
538 GameServer()->OnClientDrop(ClientId, "reconnect");
539 }
540
541 m_aClients[ClientId].m_RedirectDropTime = time_get() + time_freq() * 10;
542 m_aClients[ClientId].m_State = CClient::STATE_REDIRECTED;
543}
544
545void CServer::RedirectClient(int ClientId, int Port)
546{

Callers

nothing calls this directly

Calls 4

time_getFunction · 0.85
time_freqFunction · 0.85
OnClientDropMethod · 0.80
AddressMethod · 0.45

Tested by

no test coverage detected