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