SV_RateDrop Returns true if the client is over its current bandwidth estimation and should not be sent another packet
(client_t c)
| 601 | * bandwidth estimation and should not be sent another packet |
| 602 | */ |
| 603 | boolean SV_RateDrop(client_t c) { |
| 604 | |
| 605 | // never drop over the loopback |
| 606 | if (c.netchan.remote_address.type == NetAddrType.NA_LOOPBACK) |
| 607 | return false; |
| 608 | |
| 609 | int total = 0; |
| 610 | |
| 611 | for (int i = 0; i < Defines.RATE_MESSAGES; i++) { |
| 612 | total += c.message_size[i]; |
| 613 | } |
| 614 | |
| 615 | if (total > c.rate) { |
| 616 | c.surpressCount++; |
| 617 | c.message_size[frameNum % Defines.RATE_MESSAGES] = 0; |
| 618 | return true; |
| 619 | } |
| 620 | |
| 621 | return false; |
| 622 | } |
| 623 | |
| 624 | /** |
| 625 | * Reads packets from the network or loopback. |
no outgoing calls
no test coverage detected