ehm
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Tue, 20 Oct 2015 01:36:27 +0000 (01:36 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Tue, 20 Oct 2015 01:36:27 +0000 (01:36 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@253 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

index c7f8013..a243c16 100644 (file)
@@ -1051,20 +1051,20 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
      ptr++;\r
      if_exists(ip,ips,eq(ip->addr,_))\r
      {\r
-      int unshape_this_ip = stop_shaping;\r
+      int unshape_this_ip;\r
       long avg_mbps_down = ip->traffic_down * 8 / how_much_seconds; \r
       long avg_mbps_up = ip->traffic_up * 8 / how_much_seconds;\r
-      int min_mbps = ip->min>>10;\r
       int agreg = 1, print_stats = 1;\r
       \r
-      if(min_mbps < 1)\r
-      {\r
-       min_mbps = 1;\r
-      }\r
-      \r
       if(ip->keyword->download_aggregation)\r
       {\r
-       if(min_mbps/ip->keyword->download_aggregation <= avg_mbps_down)\r
+       int min_mbps = (ip->min/ip->keyword->download_aggregation)>>10;\r
+       if(min_mbps < 1)\r
+       {\r
+        min_mbps = 1;\r
+       }\r
+  \r
+       if(min_mbps <= avg_mbps_down)\r
        {\r
         unshape_this_ip = 0;\r
         agreg = (int)((float)(avg_mbps_down+1)/min_mbps+.5);\r
@@ -1079,7 +1079,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
       }\r
       else if(ip->keyword->upload_aggregation)\r
       {\r
-       if(min_mbps/ip->keyword->upload_aggregation <= avg_mbps_up)\r
+       int min_mbps = (ip->min/ip->keyword->upload_aggregation)>>10;\r
+       if(min_mbps < 1)\r
+       {\r
+        min_mbps = 1;\r
+       }\r
+\r
+       if(min_mbps <= avg_mbps_up)\r
        {\r
         unshape_this_ip = 0;\r
         agreg = (int)((float)(avg_mbps_up+1)/min_mbps+.5);\r
@@ -1091,6 +1097,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
         unshape_this_ip = 1;\r
        }\r
       }\r
+      if(stop_shaping)\r
+      {\r
+       unshape_this_ip = 1;\r
+      }\r
       ip->aggregated = agreg;      \r
       ip->mark = atoi(ptr);\r
       if(ip->max < ip->desired || unshape_this_ip || reduce_ceil) /* apply or disable FUP limit immediately.... */\r
This page took 0.144697 seconds and 4 git commands to generate.