MCPcopy Index your code
hub / github.com/assaultcube/AC / disconnect_client

Function disconnect_client

source/src/server.cpp:2804–2831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2802}
2803
2804void disconnect_client(int n, int reason)
2805{
2806 ASSERT(ismainthread());
2807 if(!clients.inrange(n) || clients[n]->type!=ST_TCPIP) return;
2808 sdropflag(n);
2809 client &c = *clients[n];
2810 c.state.lastdisc = servmillis;
2811 const char *scoresaved = "";
2812 if(c.haswelcome)
2813 {
2814 savedscore *sc = findscore(c, true);
2815 if(sc)
2816 {
2817 sc->save(c.state, c.team);
2818 scoresaved = ", score saved";
2819 }
2820 }
2821 int sp = (servmillis - c.connectmillis) / 1000;
2822 if(reason>=0) mlog(ACLOG_INFO, "[%s] disconnecting client %s (%s) cn %d, %d seconds played%s", c.hostname, c.name, disc_reason(reason), n, sp, scoresaved);
2823 else mlog(ACLOG_INFO, "[%s] disconnected client %s cn %d, %d seconds played%s", c.hostname, c.name, n, sp, scoresaved);
2824 totalclients--;
2825 c.peer->data = (void *)-1;
2826 if(reason>=0) enet_peer_disconnect(c.peer, reason);
2827 clients[n]->zap();
2828 sendf(-1, 1, "rii", SV_CDIS, n);
2829 if(curvote) curvote->evaluate();
2830 if(*scoresaved && sg->mastermode == MM_MATCH) senddisconnectedscores(-1);
2831}
2832
2833void sendiplist(int receiver, int cn)
2834{

Callers 11

loopvFunction · 0.85
check_ffireFunction · 0.85
kick_abuserFunction · 0.85
disconnectMethod · 0.85
serverdamageFunction · 0.85
loopvrevFunction · 0.85
addbanFunction · 0.85
changeclientroleFunction · 0.85
polldeferredprocessingFunction · 0.85
processFunction · 0.85
serversliceFunction · 0.85

Calls 12

ismainthreadFunction · 0.85
sdropflagFunction · 0.85
findscoreFunction · 0.85
mlogFunction · 0.85
disc_reasonFunction · 0.85
enet_peer_disconnectFunction · 0.85
sendfFunction · 0.85
senddisconnectedscoresFunction · 0.85
inrangeMethod · 0.80
zapMethod · 0.80
evaluateMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected