]> johannes.truschnigg.info Git - sqm_lagthrottle/commitdiff
Make low-latency mode step downwards more gracefully
authorJohannes Truschnigg <johannes@truschnigg.info>
Sun, 20 Mar 2022 09:31:44 +0000 (10:31 +0100)
committerJohannes Truschnigg <johannes@truschnigg.info>
Sun, 20 Mar 2022 09:31:44 +0000 (10:31 +0100)
__lagdetect.awk

index c97a8fc12d86ab7ee247508c0d906614ec12f97e..5ba37515c6c0be334fd21ac8b6fc7719f5297b8e 100644 (file)
@@ -254,8 +254,9 @@ function adjust_sqm(peername, latency) {
   if (last2avg > thresh_fudged) {
     if (latency > ping_prev[peername] && latency > ping_pprev[peername]) {
       if (prefer_high_bw == 0) {
-          bw_step_rx_next = 0
-          bw_step_rx_cur = 0
+          _low_step = max(0, int((bw_step_rx_cur / 2) - 2))
+          bw_step_rx_next = _low_step
+          bw_step_rx_cur = _low_step
           print "--- " ts " low-latency mode enforces step " bw_step_rx_next " := " STEPS_RX[bw_step_rx_next] "Kbps rx=" rx_rate " tx=" tx_rate
           set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next])
          return
@@ -350,6 +351,14 @@ function set_bw(dev, kbit) {
 }
 
 
+function max (a, b) {
+  if (a > b) {
+    return a
+  }
+  return b
+}
+
+
 END {
   print "# " ts " BYE"
   # Usually not reached.