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

Method DelClientCallback

src/engine/server/server.cpp:1271–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1269#endif
1270
1271int CServer::DelClientCallback(int ClientId, const char *pReason, void *pUser)
1272{
1273 CServer *pThis = (CServer *)pUser;
1274
1275 char aBuf[256];
1276 str_format(aBuf, sizeof(aBuf), "client dropped. cid=%d addr=<{%s}> reason='%s'", ClientId, pThis->ClientAddrString(ClientId, true), pReason);
1277 pThis->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
1278
1279#if defined(CONF_FAMILY_UNIX)
1280 // Make copy of address because the client slot will be empty at the end of the function
1281 const NETADDR Addr = *pThis->ClientAddr(ClientId);
1282#endif
1283
1284 // notify the mod about the drop
1285 if(pThis->m_aClients[ClientId].m_State >= CClient::STATE_READY)
1286 pThis->GameServer()->OnClientDrop(ClientId, pReason);
1287
1288 pThis->m_aClients[ClientId].m_State = CClient::STATE_EMPTY;
1289 pThis->m_aClients[ClientId].m_aName[0] = 0;
1290 pThis->m_aClients[ClientId].m_aClan[0] = 0;
1291 pThis->m_aClients[ClientId].m_Country = -1;
1292 pThis->m_aClients[ClientId].m_AuthKey = -1;
1293 pThis->m_aClients[ClientId].m_AuthTries = 0;
1294 pThis->m_aClients[ClientId].m_AuthHidden = false;
1295 pThis->m_aClients[ClientId].m_pRconCmdToSend = nullptr;
1296 pThis->m_aClients[ClientId].m_MaplistEntryToSend = CClient::MAPLIST_UNINITIALIZED;
1297 pThis->m_aClients[ClientId].m_Traffic = 0;
1298 pThis->m_aClients[ClientId].m_TrafficSince = 0;
1299 pThis->m_aClients[ClientId].m_ShowIps = false;
1300 pThis->m_aClients[ClientId].m_DebugDummy = false;
1301 pThis->m_aClients[ClientId].m_ForceHighBandwidthOnSpectate = false;
1302 pThis->m_aPrevStates[ClientId] = CClient::STATE_EMPTY;
1303 pThis->m_aClients[ClientId].m_Snapshots.PurgeAll();
1304 pThis->m_aClients[ClientId].m_Sixup = false;
1305 pThis->m_aClients[ClientId].m_RedirectDropTime = 0;
1306 pThis->m_aClients[ClientId].m_HasPersistentData = false;
1307
1308 pThis->GameServer()->TeehistorianRecordPlayerDrop(ClientId, pReason);
1309 pThis->Antibot()->OnEngineClientDrop(ClientId, pReason);
1310#if defined(CONF_FAMILY_UNIX)
1311 pThis->SendConnLoggingCommand(CLOSE_SESSION, &Addr);
1312#endif
1313 return 0;
1314}
1315
1316void CServer::SendRconType(int ClientId, bool UsernameReq)
1317{

Callers

nothing calls this directly

Calls 12

str_formatFunction · 0.85
ClientAddrStringMethod · 0.80
OnClientDropMethod · 0.80
PurgeAllMethod · 0.80
OnEngineClientDropMethod · 0.80
PrintMethod · 0.45
ConsoleMethod · 0.45
ClientAddrMethod · 0.45
GameServerMethod · 0.45
AntibotMethod · 0.45

Tested by

no test coverage detected