n-acd: use RFC 5227 timeout for announcements

When doing announcements, use the the timeout specified by RFC
5227. Note that timeout_multiplier might be 0.

This aligns behavior to upstream version of n-acd.
This commit is contained in:
Beniamino Galvani
2018-05-17 16:40:37 +02:00
parent d97eab6c5a
commit 2f4b3392d5
2 changed files with 10 additions and 1 deletions

View File

@@ -563,7 +563,14 @@ static int n_acd_handle_timeout(NAcd *acd) {
return r;
if (++acd->n_iteration < N_ACD_RFC_ANNOUNCE_NUM) {
r = n_acd_schedule(acd, acd->timeout_multiplier * N_ACD_RFC_ANNOUNCE_INTERVAL_USEC, 0);
/*
* Announcements are always scheduled according to the
* time-intervals specified in the spec. We always use
* the RFC5227-mandated multiplier.
* If you reconsider this, note that timeout_multiplier
* might be 0 here.
*/
r = n_acd_schedule(acd, N_ACD_TIMEOUT_RFC5227 * N_ACD_RFC_ANNOUNCE_INTERVAL_USEC, 0);
if (r < 0)
return r;
}

View File

@@ -15,6 +15,8 @@ extern "C" {
#include <netinet/in.h>
#include <stdbool.h>
#define N_ACD_TIMEOUT_RFC5227 (UINT64_C(9000))
enum {
_N_ACD_E_SUCCESS,