| 2802 | } |
| 2803 | |
| 2804 | void 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 | |
| 2833 | void sendiplist(int receiver, int cn) |
| 2834 | { |
no test coverage detected