Used by SV_Shutdown to send a final message to all connected clients before the server goes down. The messages are sent immediately, not just stuck on the outgoing message list, because the server is going to totally exit after returning from this function.
(String message, boolean reconnect)
| 913 | * totally exit after returning from this function. |
| 914 | */ |
| 915 | private void SV_FinalMessage(String message, boolean reconnect) { |
| 916 | |
| 917 | Collection<NetworkMessage> msgs = new ArrayList<>(); |
| 918 | msgs.add(new PrintMessage(Defines.PRINT_HIGH, message)); |
| 919 | |
| 920 | if (reconnect) |
| 921 | msgs.add(new ReconnectMessage()); |
| 922 | else |
| 923 | msgs.add(new DisconnectMessage()); |
| 924 | |
| 925 | // send it twice |
| 926 | // stagger the packets to crutch operating system limited buffers |
| 927 | for (client_t cl : clients) { |
| 928 | if (cl.state == ClientStates.CS_CONNECTED || cl.state == ClientStates.CS_SPAWNED) |
| 929 | cl.netchan.transmit(msgs); |
| 930 | } |
| 931 | for (client_t cl : clients) { |
| 932 | if (cl.state == ClientStates.CS_CONNECTED || cl.state == ClientStates.CS_SPAWNED) |
| 933 | cl.netchan.transmit(msgs); |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | /** |
| 938 | * Called when each game quits, before Sys_Quit or Sys_Error. |
no test coverage detected