Skip to content

Commit

Permalink
Update LibreQoS.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rchac authored Feb 19, 2025
1 parent f113c1b commit 07f3de8
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/LibreQoS.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ def quantum(rateInMbps):
quantrumString = " quantum " + str(quantum)
return quantrumString

# Automatically account for TCP overhead of plans. For example a 100Mbps plan needs to be set to 109Mbps for the user to ever see that result on a speed test
# Does not apply to nodes of any sort, just endpoint devices
tcpOverheadFactor = 1.09

def shell(command):
if enable_actual_shell_commands():
if run_shell_commands_as_sudo():
Expand Down Expand Up @@ -362,10 +358,10 @@ def loadSubscriberCircuits(shapedDevicesFile):
raise ValueError(errorMessageString)
# Check if bandwidth parameters match other cdevices of this same circuit ID, but only check if monitorOnlyMode is Off
if monitor_mode_only() == False:
if ((circuit['minDownload'] != round(int(downloadMin)*tcpOverheadFactor))
or (circuit['minUpload'] != round(int(uploadMin)*tcpOverheadFactor))
or (circuit['maxDownload'] != round(int(downloadMax)*tcpOverheadFactor))
or (circuit['maxUpload'] != round(int(uploadMax)*tcpOverheadFactor))):
if ((circuit['minDownload'] != int(downloadMin))
or (circuit['minUpload'] != int(uploadMin))
or (circuit['maxDownload'] != int(downloadMax))
or (circuit['maxUpload'] != int(uploadMax))):
warnings.warn("Device " + deviceName + " with ID " + deviceID + " had different bandwidth parameters than other devices on this circuit. Will instead use the bandwidth parameters defined by the first device added to its circuit.", stacklevel=2)
devicesListForCircuit = circuit['devices']
thisDevice = {
Expand Down Expand Up @@ -399,16 +395,16 @@ def loadSubscriberCircuits(shapedDevicesFile):
"circuitName": circuitName,
"ParentNode": ParentNode,
"devices": deviceListForCircuit,
"minDownload": round(int(downloadMin)*tcpOverheadFactor),
"minUpload": round(int(uploadMin)*tcpOverheadFactor),
"maxDownload": round(int(downloadMax)*tcpOverheadFactor),
"maxUpload": round(int(uploadMax)*tcpOverheadFactor),
"minDownload": int(downloadMin),
"minUpload": int(uploadMin),
"maxDownload": int(downloadMax),
"maxUpload": int(uploadMax),
"classid": '',
"comment": comment
}
if thisCircuit['ParentNode'] == 'none':
thisCircuit['idForCircuitsWithoutParentNodes'] = counterForCircuitsWithoutParentNodes
dictForCircuitsWithoutParentNodes[counterForCircuitsWithoutParentNodes] = ((round(int(downloadMax)*tcpOverheadFactor))+(round(int(uploadMax)*tcpOverheadFactor)))
dictForCircuitsWithoutParentNodes[counterForCircuitsWithoutParentNodes] = ((int(downloadMax))+(int(uploadMax)))
counterForCircuitsWithoutParentNodes += 1
subscriberCircuits.append(thisCircuit)
# If there is nothing in the circuit ID field
Expand All @@ -433,16 +429,16 @@ def loadSubscriberCircuits(shapedDevicesFile):
"circuitName": circuitName,
"ParentNode": ParentNode,
"devices": deviceListForCircuit,
"minDownload": round(int(downloadMin)*tcpOverheadFactor),
"minUpload": round(int(uploadMin)*tcpOverheadFactor),
"maxDownload": round(int(downloadMax)*tcpOverheadFactor),
"maxUpload": round(int(uploadMax)*tcpOverheadFactor),
"minDownload": int(downloadMin),
"minUpload": int(uploadMin),
"maxDownload": int(downloadMax),
"maxUpload": int(uploadMax),
"classid": '',
"comment": comment
}
if thisCircuit['ParentNode'] == 'none':
thisCircuit['idForCircuitsWithoutParentNodes'] = counterForCircuitsWithoutParentNodes
dictForCircuitsWithoutParentNodes[counterForCircuitsWithoutParentNodes] = ((round(int(downloadMax)*tcpOverheadFactor))+(round(int(uploadMax)*tcpOverheadFactor)))
dictForCircuitsWithoutParentNodes[counterForCircuitsWithoutParentNodes] = ((int(downloadMax))+(int(uploadMax)))
counterForCircuitsWithoutParentNodes += 1
subscriberCircuits.append(thisCircuit)
return (subscriberCircuits, dictForCircuitsWithoutParentNodes)
Expand Down

0 comments on commit 07f3de8

Please sign in to comment.