MCPcopy Create free account
hub / github.com/F-Stack/f-stack / should_backoff

Function should_backoff

freebsd/netinet/cc/cc_hd.c:106–123  ·  view source on GitHub ↗

* Hamilton backoff function. Returns 1 if we should backoff or 0 otherwise. */

Source from the content-addressed store, hash-verified

104 * Hamilton backoff function. Returns 1 if we should backoff or 0 otherwise.
105 */
106static __inline int
107should_backoff(int qdly, int maxqdly)
108{
109 unsigned long p;
110
111 if (qdly < V_hd_qthresh) {
112 p = (((RANDOM_MAX / 100) * V_hd_pmax) /
113 (V_hd_qthresh - V_hd_qmin)) * (qdly - V_hd_qmin);
114 } else {
115 if (qdly > V_hd_qthresh)
116 p = (((RANDOM_MAX / 100) * V_hd_pmax) /
117 (maxqdly - V_hd_qthresh)) * (maxqdly - qdly);
118 else
119 p = (RANDOM_MAX / 100) * V_hd_pmax;
120 }
121
122 return (random() < p);
123}
124
125/*
126 * If the ack type is CC_ACK, and the inferred queueing delay is greater than

Callers 1

hd_ack_receivedFunction · 0.70

Calls 1

randomFunction · 0.50

Tested by

no test coverage detected