| 519 | } |
| 520 | |
| 521 | void 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 | |
| 545 | void CServer::RedirectClient(int ClientId, int Port) |
| 546 | { |
nothing calls this directly
no test coverage detected