Changeset 926
- Timestamp:
- May 10, 2022, 11:08:30 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php
r899 r926 29 29 var $LimitIn; 30 30 var $LimitOut; 31 var $FixedSpeed; 31 32 var $SubItems; 32 33 … … 37 38 if ($Parent != null) $Parent->SubItems->Add($this); 38 39 $this->SubItems = new SpeedLimitItems(); 40 $this->FixedSpeed = false; 39 41 } 40 42 … … 94 96 $this->LimitOut->Min = $SpeedMinOut; 95 97 $this->LimitIn->Min = $SpeedMinIn; 98 } 99 } 100 101 function AdjustMinSpeedsToMax(float $MultiplierIn, float $MultiplierOut): void 102 { 103 foreach ($this->SubItems->Items as $Index => $Item) 104 { 105 $this->SubItems->Items[$Index]->AdjustMinSpeedsToMax($MultiplierIn, $MultiplierOut); 106 } 107 if ($this->FixedSpeed == false) 108 { 109 $this->LimitOut->Min = round($this->LimitOut->Min * $MultiplierOut); 110 if ($this->LimitOut->Min > $this->LimitOut->Max) 111 { 112 echo($this->Name.': '.$this->LimitOut->Min.' > '.$this->LimitOut->Max."\n"); 113 $this->LimitOut->Min = $this->LimitOut->Max; 114 } 115 $this->LimitIn->Min = round($this->LimitIn->Min * $MultiplierIn); 116 if ($this->LimitIn->Min > $this->LimitIn->Max) 117 { 118 echo($this->Name.': '.$this->LimitIn->Min.' > '.$this->LimitIn->Max."\n"); 119 $this->LimitIn->Min = $this->LimitIn->Max; 120 } 96 121 } 97 122 } … … 185 210 $Free->LimitIn = new SpeedLimit($FreeInetSpeed, $FreeInetSpeed, GetMarkByComment('free-in')); 186 211 $Free->LimitOut = new SpeedLimit($FreeInetSpeed, $FreeInetSpeed, GetMarkByComment('free-out')); 212 $Free->FixedSpeed = true; 187 213 188 214 // Process users … … 271 297 } 272 298 $Main->UpdateMinSpeeds(); 299 $Main->AdjustMinSpeedsToMax($Main->LimitIn->Max / $Main->LimitIn->Min, 300 $Main->LimitOut->Max / $Main->LimitOut->Min); 301 273 302 echo($Main->Print()); 274 303 $ItemsQueue = $Main->GetCommands();
Note:
See TracChangeset
for help on using the changeset viewer.