]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
Reject contracts with zero period and budget
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 10 Aug 2009 14:46:58 +0000 (16:46 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 10 Aug 2009 16:19:25 +0000 (18:19 +0200)
fwp/mngr/fwp_admctrl.c

index 62ee83f88b24434a5caeb8c2cf70bb22ecefe231..f51e06d5ec54ff0fa0322145cb2e7cf2baa31a13 100644 (file)
@@ -175,10 +175,12 @@ int fwp_admctrl_utilization(struct fres_sa_scenario *scenario, void *priv,
                       fosa_rel_time_to_msec(basic->period),
                       (long unsigned int)bytes);
 
+               period_usec = basic ? fosa_rel_time_to_msec(basic->period)*1000 : 0;
+
                /* Calculate protocol overhead */
                fragments = (bytes + MTU - 1) / MTU;
 
-               if (fragments == 0)
+               if (fragments == 0 && period_usec != 0)
                        continue;
 
                const int data_overhead = UDP_HEADER_SIZE + IP_HEADER_SIZE +
@@ -202,9 +204,6 @@ int fwp_admctrl_utilization(struct fres_sa_scenario *scenario, void *priv,
                 * AP may use different values for backoff. */
                //duration_usec *= 2; /* For demo, we have always STA-to-STA */
 
-               basic = fres_contract_get_basic(c->contract);
-               period_usec = basic ? fosa_rel_time_to_msec(basic->period)*1000 : 0;
-
                if (c->contract == c->new) {
                        if (period_usec == 0) {
                                ul_logmsg("Period is zero!\n");