Commit d3be24c7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move schedule_flush_now to a more reasonable place.

parent e51be7a0
......@@ -273,6 +273,17 @@ schedule_flush(struct network *net)
net->flush_time.tv_sec = now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
void
schedule_flush_now(struct network *net)
{
int msecs = random() % 10;
if(net->flush_time.tv_sec != 0 &&
timeval_minus_msec(&net->flush_time, &now) < msecs)
return;
net->flush_time.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
net->flush_time.tv_sec = now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
static void
start_message(struct network *net, int bytes)
{
......@@ -702,15 +713,3 @@ send_txcost(struct neighbour *neigh, struct network *net)
schedule_flush(net);
}
}
void
schedule_flush_now(struct network *net)
{
int msecs = random() % 10;
if(net->flush_time.tv_sec != 0 &&
timeval_minus_msec(&net->flush_time, &now) < msecs)
return;
net->flush_time.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
net->flush_time.tv_sec = now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment