Commit 3580913a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename flush_time to flush_timeout for consistency.

parent f3ed6390
......@@ -528,14 +528,14 @@ main(int argc, char **argv)
for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
timeval_min(&tv, &nets[i].flush_time);
timeval_min(&tv, &nets[i].flush_timeout);
timeval_min(&tv, &nets[i].hello_timeout);
if(!network_idle(&nets[i])) {
timeval_min(&tv, &nets[i].self_update_timeout);
timeval_min(&tv, &nets[i].update_timeout);
}
}
timeval_min(&tv, &update_flush_time);
timeval_min(&tv, &update_flush_timeout);
FD_ZERO(&readfds);
if(timeval_compare(&tv, &now) > 0) {
timeval_minus(&tv, &tv, &now);
......@@ -653,16 +653,16 @@ main(int argc, char **argv)
if(now.tv_sec >= request_resend_time)
resend_requests();
if(update_flush_time.tv_sec != 0) {
if(now.tv_sec >= update_flush_time.tv_sec)
if(update_flush_timeout.tv_sec != 0) {
if(now.tv_sec >= update_flush_timeout.tv_sec)
flushupdates();
}
for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
if(nets[i].flush_time.tv_sec != 0) {
if(timeval_compare(&now, &nets[i].flush_time) >= 0)
if(nets[i].flush_timeout.tv_sec != 0) {
if(timeval_compare(&now, &nets[i].flush_timeout) >= 0)
flushbuf(&nets[i]);
}
}
......
......@@ -39,7 +39,7 @@ THE SOFTWARE.
#include "message.h"
#include "filter.h"
struct timeval update_flush_time = {0, 0};
struct timeval update_flush_timeout = {0, 0};
const unsigned char packet_header[8] = {42, 1};
......@@ -361,19 +361,19 @@ flushbuf(struct network *net)
}
VALGRIND_MAKE_MEM_UNDEFINED(net->sendbuf, net->bufsize);
net->buffered = 0;
net->flush_time.tv_sec = 0;
net->flush_time.tv_usec = 0;
net->flush_timeout.tv_sec = 0;
net->flush_timeout.tv_usec = 0;
}
static void
schedule_flush(struct network *net)
{
int msecs = jitter(net);
if(net->flush_time.tv_sec != 0 &&
timeval_minus_msec(&net->flush_time, &now) < msecs)
if(net->flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&net->flush_timeout, &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;
net->flush_timeout.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
net->flush_timeout.tv_sec = now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
void
......@@ -381,11 +381,12 @@ schedule_flush_now(struct network *net)
{
/* Almost now */
int msecs = 5 + random() % 5;
if(net->flush_time.tv_sec != 0 &&
timeval_minus_msec(&net->flush_time, &now) < msecs)
if(net->flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&net->flush_timeout, &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;
net->flush_timeout.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
net->flush_timeout.tv_sec =
now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
static void
......@@ -674,8 +675,8 @@ flushupdates(void)
VALGRIND_MAKE_MEM_UNDEFINED(&buffered_updates,
sizeof(buffered_updates));
}
update_flush_time.tv_sec = 0;
update_flush_time.tv_usec = 0;
update_flush_timeout.tv_sec = 0;
update_flush_timeout.tv_usec = 0;
}
static void
......@@ -683,11 +684,12 @@ schedule_update_flush(struct network *net, int urgent)
{
int msecs;
msecs = update_jitter(net, urgent);
if(update_flush_time.tv_sec != 0 &&
timeval_minus_msec(&update_flush_time, &now) < msecs)
if(update_flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&update_flush_timeout, &now) < msecs)
return;
update_flush_time.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
update_flush_time.tv_sec = now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
update_flush_timeout.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
update_flush_timeout.tv_sec =
now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
static void
......
......@@ -31,7 +31,7 @@ extern int silent_time;
extern int broadcast_ihu;
extern int split_horizon;
extern struct timeval update_flush_time;
extern struct timeval update_flush_timeout;
extern const unsigned char packet_header[8];
unsigned short hash_id(const unsigned char *id) ATTRIBUTE ((pure));
......
......@@ -36,7 +36,7 @@ struct network {
char ifname[IF_NAMESIZE];
unsigned char *ipv4;
int buffered;
struct timeval flush_time;
struct timeval flush_timeout;
int bufsize;
unsigned char *sendbuf;
int bucket_time;
......
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