bug for magic-relative-prio 0 fixed
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Fri, 1 Feb 2008 21:37:55 +0000 (21:37 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Fri, 1 Feb 2008 21:37:55 +0000 (21:37 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@56 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

index 282e0db..3abaa34 100644 (file)
@@ -173,7 +173,7 @@ struct Keyword
  int asymetry_ratio;        /* ratio for ADSL-like upload */\r
  int asymetry_fixed;        /* fixed treshold for ADSL-like upload */\r
  int data_limit;            /* hard shaping: apply magic_treshold if max*data_limit MB exceeded */\r
- int prio_limit;            /* soft shaping (qos): reduce HTB prio if max*prio_limit MB exceeded */\r
+ int data_prio;            /* soft shaping (qos): reduce HTB prio if max*data_prio MB exceeded */\r
  long fixed_limit;          /* fixed data limit for setting lower HTB ceil */\r
  long fixed_prio;           /* fixed data lmit for setting lower HTB prio */\r
  int reserve_min;          /* bonus for nominal HTB rate bandwidth (in kbps) */\r
@@ -302,7 +302,7 @@ void get_config(char *config_filename)
    keyword->asymetry_ratio=1;          /* ratio for ADSL-like upload */\r
    keyword->asymetry_fixed=0;          /* fixed treshold for ADSL-like upload */\r
    keyword->data_limit=8;              /* hard shaping: apply magic_treshold if max*data_limit MB exceeded */\r
-   keyword->prio_limit=4;              /* soft shaping (qos): reduce HTB prio if max*prio_limit MB exceeded */\r
+   keyword->data_prio=4;              /* soft shaping (qos): reduce HTB prio if max*data_prio MB exceeded */\r
    keyword->fixed_limit=0;             /* fixed data limit for setting lower HTB ceil */\r
    keyword->fixed_prio=0;              /* fixed data limit for setting lower HTB prio */\r
    keyword->reserve_min=8;            /* bonus for nominal HTB rate bandwidth (in kbps) */\r
@@ -334,7 +334,7 @@ void get_config(char *config_filename)
     ioption("asymetry-ratio",keyword->asymetry_ratio);\r
     ioption("asymetry-treshold",keyword->asymetry_fixed);\r
     ioption("magic-relative-limit",keyword->data_limit);\r
-    ioption("magic-relative-prio",keyword->prio_limit);\r
+    ioption("magic-relative-prio",keyword->data_prio);\r
     loption("magic-fixed-limit",keyword->fixed_limit);\r
     loption("magic-fixed-prio",keyword->fixed_prio);\r
     ioption("htb-default-prio",keyword->default_prio);\r
@@ -349,7 +349,7 @@ void get_config(char *config_filename)
     _=tmptr;\r
     \r
     if(keyword->data_limit || keyword->fixed_limit || \r
-       keyword->prio_limit || keyword->fixed_prio)\r
+       keyword->data_prio || keyword->fixed_prio)\r
         use_credit=1;\r
         \r
 \r
@@ -1064,10 +1064,9 @@ Credits: CZFree.Net, Martin Devera, Netdave, Aquarius\n\n",version);
     \r
     search(ip, ips, ip->min==group->min && ip->max>ip->min)\r
     {\r
-     if(ip->keyword->data_limit>0 &&\r
+     if( ip->keyword->data_limit && !ip->fixedprio &&\r
          ip->traffic>ip->credit+\r
-         (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)) \r
-        && !ip->fixedprio)\r
+         (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)) )\r
      {\r
       if(group_rate<ip->max) ip->max=group_rate;\r
       group_rate+=magic_treshold;\r
@@ -1076,9 +1075,9 @@ Credits: CZFree.Net, Martin Devera, Netdave, Aquarius\n\n",version);
      }\r
      else\r
      {\r
-      if(ip->traffic>ip->credit+\r
-          (ip->min*ip->keyword->prio_limit+(ip->keyword->fixed_prio<<20)) && \r
-         !ip->fixedprio)\r
+      if( keyword->data_prio && !ip->fixedprio &&\r
+          ip->traffic>ip->credit+\r
+           (ip->min*ip->keyword->data_prio+(ip->keyword->fixed_prio<<20)) )\r
       {\r
        ip->prio=priority_sequence--;\r
        if(ip->prio<2) ip->prio=2;\r
@@ -1087,6 +1086,7 @@ Credits: CZFree.Net, Martin Devera, Netdave, Aquarius\n\n",version);
       if(credit_file)\r
       {\r
        unsigned long long lcredit=0;\r
+       \r
        if((ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))>ip->traffic) \r
         lcredit=(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))-ip->traffic;\r
        fprintf(credit_file,"%s %Lu\n",ip->addr,lcredit);\r
This page took 0.193676 seconds and 4 git commands to generate.