MCPcopy Create free account
hub / github.com/demoth/jake2 / SV_CheckTimeouts

Method SV_CheckTimeouts

server/src/main/java/jake2/server/SV_MAIN.java:836–860  ·  view source on GitHub ↗

If a packet has not been received from a client for timeout.value seconds, drop the conneciton. Server frames are used instead of realtime to avoid dropping the local client while debugging. When a client is normally dropped, the client_t goes into a zombie state for a few seconds to make sure any

()

Source from the content-addressed store, hash-verified

834 * necessary.
835 */
836 void SV_CheckTimeouts() {
837
838 for (client_t cl : clients) {
839 if (cl.state == ClientStates.CS_FREE)
840 continue;
841
842 final GameImportsImpl game = games.get(cl.gameName);
843 int droppoint = (int) (game.realtime - 1000 * SV_MAIN.timeout.value);
844 int zombiepoint = (int) (game.realtime - 1000 * SV_MAIN.zombietime.value);
845
846 // message times may be wrong across a changelevel
847 if (cl.lastmessage > game.realtime)
848 cl.lastmessage = game.realtime;
849
850 if (cl.state == ClientStates.CS_ZOMBIE && cl.lastmessage < zombiepoint) {
851 cl.state = ClientStates.CS_FREE; // can now be reused
852 continue;
853 }
854 if ((cl.state == ClientStates.CS_CONNECTED || cl.state == ClientStates.CS_SPAWNED) && cl.lastmessage < droppoint) {
855 SV_BroadcastPrintf(Defines.PRINT_HIGH, cl.name + " timed out\n", cl.gameName);
856 SV_DropClient(cl);
857 cl.state = ClientStates.CS_FREE; // don't bother with zombie state
858 }
859 }
860 }
861
862 /**
863 * Updates the cl.ping variables.

Callers 1

updateMethod · 0.95

Calls 3

SV_BroadcastPrintfMethod · 0.95
SV_DropClientMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected