X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=a243c16242c3ad38625232e6110ea0d8e9c7dcd5;hp=eae8afbdea7c56c28556f968b04c95a35e535be1;hb=3335365b0903d2b1baf7331d17203490cdee65ea;hpb=62687dea69e71338cf34aa955f8fe5961f4b1f60 diff --git a/prometheus.c b/prometheus.c index eae8afb..a243c16 100644 --- a/prometheus.c +++ b/prometheus.c @@ -7,7 +7,7 @@ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20150331 +/* Modified by: xChaos, 20151020 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -29,10 +29,10 @@ #include "cll1-0.6.2.h" #include "ipstruct.h" -const char *version = "0.8.5-c"; +const char *version = "0.8.5-d"; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Versions: 0.8.3 is development release, 0.8.4 will be "stable" */ +/* Versions: 0.8.5 is development release, 0.8.6 will be "stable" */ /* Official Trac URL: https://dev.arachne.cz/svn/prometheus */ /* Official SVN URL: https://dev.arachne.cz/repos/prometheus */ /* BTC donations account: 19rriLx8vR19wGefPaMhakqnCYNYwjLvxq */ @@ -1051,24 +1051,25 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); ptr++; if_exists(ip,ips,eq(ip->addr,_)) { - int unshape_this_ip = stop_shaping; + int unshape_this_ip; long avg_mbps_down = ip->traffic_down * 8 / how_much_seconds; long avg_mbps_up = ip->traffic_up * 8 / how_much_seconds; - int min_mbps = ip->min>>10; int agreg = 1, print_stats = 1; - if(min_mbps < 1) - { - min_mbps = 1; - } - if(ip->keyword->download_aggregation) { + int min_mbps = (ip->min/ip->keyword->download_aggregation)>>10; + if(min_mbps < 1) + { + min_mbps = 1; + } + if(min_mbps <= avg_mbps_down) { unshape_this_ip = 0; agreg = (int)((float)(avg_mbps_down+1)/min_mbps+.5); ip->max /= agreg; + ip->pps_limit /= agreg; printf("Download aggregation 1:%d for %s (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_down); } else @@ -1078,6 +1079,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } else if(ip->keyword->upload_aggregation) { + int min_mbps = (ip->min/ip->keyword->upload_aggregation)>>10; + if(min_mbps < 1) + { + min_mbps = 1; + } + if(min_mbps <= avg_mbps_up) { unshape_this_ip = 0; @@ -1090,6 +1097,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); unshape_this_ip = 1; } } + if(stop_shaping) + { + unshape_this_ip = 1; + } ip->aggregated = agreg; ip->mark = atoi(ptr); if(ip->max < ip->desired || unshape_this_ip || reduce_ceil) /* apply or disable FUP limit immediately.... */