fix 0ms latency issue with tbf, bypassing in kernel...

This commit is contained in:
Quentin De Coninck 2017-09-28 16:57:41 +02:00 committed by None
parent 3df01c4e64
commit de6807a433

View File

@ -17,11 +17,13 @@ class MpLinkCharacteristics:
rtt = 2 * float(delay) rtt = 2 * float(delay)
bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000)) bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000))
if int(queueSize) <= bdp_queue_size: if int(queueSize) <= bdp_queue_size:
return 0 # Returning 0 seems to bypass everything, then only limited by CPU.
# This is not what we want...
return 1
queuingQueueSize = int(queueSize) - bdp_queue_size queuingQueueSize = int(queueSize) - bdp_queue_size
queuingDelay = (queuingQueueSize * int(mtu) * 8 * 1000) / (float(bandwidth) * 1024 * 1024) queuingDelay = (queuingQueueSize * int(mtu) * 8 * 1000) / (float(bandwidth) * 1024 * 1024)
return int(queuingDelay) return max(int(queuingDelay), 1)
def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False): def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False):
self.id = id self.id = id