X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Fstandard.c;h=5b9632e5eca2999c38c9d023975447ff676df77c;hp=5b860a31b0f48bd1d246408e44ead15f5acd562c;hb=fd949261f2be814d8deb410999e1dafcc2c5bb35;hpb=28e1741a1a10567be2a6b02d1ba468b9f62ba33c diff --git a/drl/standard.c b/drl/standard.c index 5b860a3..5b9632e 100644 --- a/drl/standard.c +++ b/drl/standard.c @@ -137,7 +137,6 @@ int standard_table_sample(standard_flow_table table, const key_flow *key) { void standard_table_remove(standard_flow_table table, standard_flow *flow) { key_flow key; uint32_t hash; - standard_flow *current, *prev; assert(flow); @@ -156,23 +155,23 @@ void standard_table_remove(standard_flow_table table, standard_flow *flow) { /* It's the head of the hash list. */ table->flows[hash] = flow->nexth; } else { + standard_flow *current, *prev; + prev = table->flows[hash]; - current = table->flows[hash]->nexth; - while (current != NULL) { + for (current = table->flows[hash]->nexth; current; current = current->nexth) { if (current == flow) { prev->nexth = flow->nexth; break; } else { prev = current; - current = current->next; } } - //assert(current != NULL); if (current == NULL) { - printlog(LOG_DEBUG, "Flow %p disappeared?\n", flow); + printlog(LOG_CRITICAL, "Flow %p disappeared?\n", flow); } + assert(current != NULL); } /* Remove the flow from the linked list. */