Changeset 970 for trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php
- Timestamp:
- Jul 17, 2024, 10:48:28 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php
r929 r970 3 3 class SpeedLimit 4 4 { 5 var$Min;6 var$Max;7 var$PacketMark;5 public int $Min; 6 public int $Max; 7 public ?int $PacketMark; 8 8 9 9 function __construct(int $Min, int $Max, int $PacketMark = null) … … 25 25 class SpeedLimitItem 26 26 { 27 var$Name;28 var$Parent;29 var$LimitIn;30 var$LimitOut;31 var$FixedSpeed;32 var$SubItems;27 public string $Name; 28 public ?SpeedLimitItem $Parent; 29 public SpeedLimit $LimitIn; 30 public SpeedLimit $LimitOut; 31 public bool $FixedSpeed; 32 public SpeedLimitItems $SubItems; 33 33 34 34 function __construct(string $Name, SpeedLimitItem $Parent = null) … … 184 184 $UsersMaxSpeedIn = round($Finance->MaxSpeed / $InDivider) * 1000; 185 185 $UsersMaxSpeedOut = round($Finance->MaxSpeed / $OutDivider) * 1000; 186 $VoipMaxSpeedIn = $TotalMaxSpeedIn - 136;187 $VoipMaxSpeedOut = $TotalMaxSpeedOut - 136;188 $VoipSpeedIn = 100; //$SpeedReserve;189 $VoipSpeedOut = 100; //$SpeedReserve;190 186 $OutInterface = 'eth1'; 191 187 $InInterface = 'ifb0'; … … 206 202 $this->LoadSpeedLimits($Main); 207 203 208 // Slow free internet204 // Free internet 209 205 $Free = new SpeedLimitItem('free', $Main); 210 206 $Free->LimitIn = new SpeedLimit($FreeInetSpeed, $FreeInetSpeed, GetMarkByComment('free-in')); … … 226 222 while ($Service = $DbResult4->fetch_assoc()) 227 223 { 224 $MinSpeed = $Service['InternetSpeedMin']; 225 $MaxSpeed = $Service['InternetSpeedMax']; 226 if ($Service['InternetSpeedBonus'] > $MaxSpeed) $MaxSpeed = $Service['InternetSpeedBonus']; 227 228 228 echo('Služba '.$Service['Name'].': '); 229 229 $MemberName = RouterOSIdent($Member['Name'].'-'.$Member['Id'].'-'.$ServiceIndex); 230 $SpeedIn = round($Service['InternetSpeedMin'] / $InDivider); 231 $SpeedOut = round($Service['InternetSpeedMin'] / $OutDivider); 232 $UserMaxSpeedIn = round($Service['InternetSpeedMax'] / $InDivider); 233 $UserMaxSpeedOut = round($Service['InternetSpeedMax'] / $OutDivider); 230 $MinReduction = 100; 231 $SpeedIn = round($MinSpeed / $InDivider / $MinReduction); 232 $SpeedOut = round($MinSpeed / $OutDivider / $MinReduction); 233 $UserMaxSpeedIn = round($MaxSpeed / $InDivider); 234 $UserMaxSpeedOut = round($MaxSpeed / $OutDivider); 234 235 235 236 // Reduce max speed by speed limits … … 302 303 echo($Main->Print()); 303 304 $ItemsQueue = $Main->GetCommands(); 304 $Routerboard->ListUpdate($PathQueue, array('name', 'limit-at', 'max-limit', 'parent', 'packet-mark'), $ItemsQueue, array(), true);305 //$Routerboard->ListUpdate($PathQueue, array('name', 'limit-at', 'max-limit', 'parent', 'packet-mark'), $ItemsQueue, array(), true); 305 306 } 306 307 … … 415 416 while (count($DevicesToCheck) > 0) 416 417 { 417 //echo('Pass'."\n");418 418 $NewDevicesToCheck = array(); 419 419 foreach ($DevicesToCheck as $DeviceId) 420 420 { 421 //echo($this->Devices[$DeviceId]['Name'].': ');422 421 foreach ($this->Devices[$DeviceId]['Interfaces'] as $InterfaceId) 423 422 { … … 435 434 if ($NewMaxSpeed > $Link['MaxRealSpeed']) 436 435 $NewMaxSpeed = $Link['MaxRealSpeed']; 437 //echo($this->Devices[$Device2Id]['Name'].' '.$Device2Id.', ');438 436 $this->Devices[$Device2Id]['MaxSpeed'] = $NewMaxSpeed; 439 437 // Set nodes tree relation 440 438 $this->Devices[$Device2Id]['Parent'] = $DeviceId; 441 439 $this->Devices[$DeviceId]['Childs'][] = $Device2Id; 442 //echo($NewMaxSpeed.", ".count($NewDevicesToCheck).' ');443 440 $NewDevicesToCheck[] = $Device2Id; 444 441 } 445 442 } 446 443 } 447 //echo("\n");448 444 } 449 445 $DevicesToCheck = $NewDevicesToCheck; … … 515 511 $InDivider = 1; 516 512 $OutDivider = 1; 517 $TotalMaxSpeedIn = round($Finance->RealMaxSpeed / $InDivider) * 1000;518 $TotalMaxSpeedOut = round($Finance->RealMaxSpeed / $OutDivider) * 1000;519 513 $UsersMaxSpeedIn = round($Finance->MaxSpeed / $InDivider) * 1000; 520 514 $UsersMaxSpeedOut = round($Finance->MaxSpeed / $OutDivider) * 1000; 521 $VoipMaxSpeedIn = $TotalMaxSpeedIn - 136;522 $VoipMaxSpeedOut = $TotalMaxSpeedOut - 136;523 $VoipSpeedIn = 100; //$SpeedReserve;524 $VoipSpeedOut = 100; //$SpeedReserve;525 $OutInterface = 'eth1';526 $InInterface = 'ifb0';527 $InetInterface = $this->System->Config['MainRouter']['InetInterface'];528 515 529 516 $DbResult = $this->Database->select('Service', '*', '(`ChangeAction` IS NULL) AND (`Id`='.TARIFF_FREE.')');
Note:
See TracChangeset
for help on using the changeset viewer.