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
()
| 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. |
no test coverage detected