Commit 03bd8943 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add explicit time constant resend_delay rather than computing it on the fly.

parent 9f6b322a
...@@ -64,6 +64,7 @@ int link_detect = 0; ...@@ -64,6 +64,7 @@ int link_detect = 0;
int all_wireless = 0; int all_wireless = 0;
int wireless_hello_interval = -1; int wireless_hello_interval = -1;
int wired_hello_interval = -1; int wired_hello_interval = -1;
int resend_delay = -1;
int do_daemonise = 0; int do_daemonise = 0;
char *logfile = NULL, *pidfile = "/var/run/babeld.pid"; char *logfile = NULL, *pidfile = "/var/run/babeld.pid";
...@@ -268,6 +269,11 @@ main(int argc, char **argv) ...@@ -268,6 +269,11 @@ main(int argc, char **argv)
wired_hello_interval = 4000; wired_hello_interval = 4000;
wired_hello_interval = MAX(wired_hello_interval, 5); wired_hello_interval = MAX(wired_hello_interval, 5);
resend_delay = 2000;
resend_delay = MIN(resend_delay, wireless_hello_interval / 2);
resend_delay = MIN(resend_delay, wired_hello_interval / 2);
resend_delay = MAX(resend_delay, 20);
if(parasitic && allow_duplicates >= 0) { if(parasitic && allow_duplicates >= 0) {
/* Too difficult to get right. */ /* Too difficult to get right. */
fprintf(stderr, "Sorry, -P and -A are incompatible.\n"); fprintf(stderr, "Sorry, -P and -A are incompatible.\n");
......
...@@ -84,6 +84,7 @@ extern struct timeval now; ...@@ -84,6 +84,7 @@ extern struct timeval now;
extern int debug; extern int debug;
extern time_t reboot_time; extern time_t reboot_time;
extern int wireless_hello_interval, wired_hello_interval; extern int wireless_hello_interval, wired_hello_interval;
extern int resend_delay;
extern int link_detect; extern int link_detect;
extern int all_wireless; extern int all_wireless;
extern int local_socket; extern int local_socket;
......
...@@ -1141,17 +1141,10 @@ void ...@@ -1141,17 +1141,10 @@ void
send_update_resend(struct interface *ifp, send_update_resend(struct interface *ifp,
const unsigned char *prefix, unsigned char plen) const unsigned char *prefix, unsigned char plen)
{ {
int delay;
assert(prefix != NULL); assert(prefix != NULL);
send_update(ifp, 1, prefix, plen); send_update(ifp, 1, prefix, plen);
record_resend(RESEND_UPDATE, prefix, plen, 0, 0, NULL, resend_delay);
delay = 2000;
delay = MIN(delay, wireless_hello_interval / 2);
delay = MIN(delay, wired_hello_interval / 2);
delay = MAX(delay, 10);
record_resend(RESEND_UPDATE, prefix, plen, 0, 0, NULL, delay);
} }
void void
...@@ -1452,19 +1445,13 @@ send_request_resend(struct neighbour *neigh, ...@@ -1452,19 +1445,13 @@ send_request_resend(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
unsigned short seqno, unsigned char *id) unsigned short seqno, unsigned char *id)
{ {
int delay;
if(neigh) if(neigh)
send_unicast_multihop_request(neigh, prefix, plen, seqno, id, 127); send_unicast_multihop_request(neigh, prefix, plen, seqno, id, 127);
else else
send_multihop_request(NULL, prefix, plen, seqno, id, 127); send_multihop_request(NULL, prefix, plen, seqno, id, 127);
delay = 2000;
delay = MIN(delay, wireless_hello_interval / 2);
delay = MIN(delay, wired_hello_interval / 2);
delay = MAX(delay, 10);
record_resend(RESEND_REQUEST, prefix, plen, seqno, id, record_resend(RESEND_REQUEST, prefix, plen, seqno, id,
neigh ? neigh->ifp : NULL, delay); neigh ? neigh->ifp : NULL, resend_delay);
} }
void void
......
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