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
}\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
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