Fixes & tweaks for sample and hold accounting.
[distributedratelimiting.git] / drl / standard.c
index f8f813c..103a23c 100644 (file)
@@ -221,7 +221,7 @@ int standard_table_cleanup(standard_flow_table table) {
     time_t now = time(NULL);
 
     while (current != NULL) {
-        if (current->last_packet + FLOW_IDLE_TIME <= now) {
+        if (current->last_packet + STD_FLOW_IDLE_TIME <= now) {
             /* Flow hasn't received a packet in the time limit - kill it. */
             remove = current;
             current = current->next;
@@ -314,22 +314,18 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now,
             table->common->num_flows_20k += 1;
             table->common->num_flows_10k += 1;
             table->common->num_flows_5k += 1;
-            table->common->num_flows += 1;
         } else if (current->rate > 20480) {
             table->common->num_flows_20k += 1;
             table->common->num_flows_10k += 1;
             table->common->num_flows_5k += 1;
-            table->common->num_flows += 1;
         } else if (current->rate > 10240) {
             table->common->num_flows_10k += 1;
             table->common->num_flows_5k += 1;
-            table->common->num_flows += 1;
         } else if (current->rate > 5120) {
             table->common->num_flows_5k += 1;
-            table->common->num_flows += 1;
-        } else {
-            table->common->num_flows += 1;
-        }
+        } 
+
+        table->common->num_flows += 1;
 
         src.s_addr = ntohl(current->source_ip);
         dst.s_addr = ntohl(current->dest_ip);