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

Method SV_SendClientMessages

server/src/main/java/jake2/server/SV_MAIN.java:519–553  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517 }
518
519 void SV_SendClientMessages() {
520
521 // send a message to each connected client
522 for (client_t c : clients) {
523
524 if (c.state == ClientStates.CS_FREE)
525 continue;
526
527 GameImportsImpl game = games.get(c.gameName);
528 // if the reliable message overflowed,
529 // drop the client
530 int pendingReliableSize = c.netchan.reliablePending.stream().mapToInt(NetworkMessage::getSize).sum();
531 if (pendingReliableSize > Defines.MAX_MSGLEN - 16) {
532 c.netchan.reliablePending.clear();
533 c.unreliable.clear();
534 SV_BroadcastPrintf(Defines.PRINT_HIGH, c.name + " overflowed\n", c.gameName);
535 SV_DropClient(c);
536 }
537
538 if (game.sv.state == ServerStates.SS_CINEMATIC || game.sv.state == ServerStates.SS_DEMO || game.sv.state == ServerStates.SS_PIC) {
539 // leftover from demo code
540 c.netchan.transmit(null);
541 } else if (c.state == ClientStates.CS_SPAWNED) {
542 // don't overrun bandwidth
543 if (SV_RateDrop(c))
544 continue;
545
546 SV_SendClientDatagram(c, game);
547 } else {
548 // just update reliable if needed
549 if (c.netchan.reliablePending.size() != 0 || Globals.curtime - c.netchan.last_sent > 1000)
550 c.netchan.transmit(null);
551 }
552 }
553 }
554
555 /**
556 * Called when the player is totally leaving the server, either willingly or

Callers 2

updateMethod · 0.95
spawnServerInstanceMethod · 0.95

Calls 8

SV_BroadcastPrintfMethod · 0.95
SV_DropClientMethod · 0.95
SV_RateDropMethod · 0.95
transmitMethod · 0.80
SV_SendClientDatagramMethod · 0.80
sizeMethod · 0.80
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected