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

Method SV_RateDrop

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

SV_RateDrop Returns true if the client is over its current bandwidth estimation and should not be sent another packet

(client_t c)

Source from the content-addressed store, hash-verified

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.

Callers 1

SV_SendClientMessagesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected