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

Method SV_FinalMessage

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

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)

Source from the content-addressed store, hash-verified

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.

Callers 2

SV_ShutdownMethod · 0.95
resetClientsMethod · 0.95

Calls 2

transmitMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected