From d18903cf10fd6bbde2b2c090c1063fe7cd1e7fe9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Oct 2014 18:32:25 +0100 Subject: [PATCH] site: Change default number of mobile peers As the comment has it: - The default number of addrs to keep is 3, or 4 if we have a configured name or address. That's space for two configured addresses (one IPv6 and one IPv4), plus two received addresses. Signed-off-by: Ian Jackson --- README | 5 +++-- site.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 962755e..f5b3b2b 100644 --- a/README +++ b/README @@ -318,10 +318,11 @@ site: dict argument address may suddenly change couldn't communicate reliably because their contact addresses might both change at once. [false] mobile-peers-max (integer): Maximum number of peer port/addr pairs we - remember and send to. Must be at least 1 and no more than 5. [3] + remember and send to. Must be at least 1 and no more than 5. + [4 if an address is configured, otherwise 3] static-peers-max (integer): Maximum number of peer port/addr pairs we can try for a static site. Must be at least 1 and no more - than 5. [3] + than 5. [4 or 3, as above] mobile-peer-expiry (integer): For "mobile" peers only, the length of time (in seconds) for which we will keep sending to multiple address/ports from which we have not seen incoming traffic. [120] diff --git a/site.c b/site.c index ecb45bf..204ddf5 100644 --- a/site.c +++ b/site.c @@ -40,7 +40,6 @@ #define DEFAULT_MOBILE_WAIT_TIME (10*1000) /* [ms] */ #define DEFAULT_MOBILE_PEER_EXPIRY (2*60) /* [s] */ -#define DEFAULT_PEERS_MAX 3 /* send at most this many copies (default) */ /* Each site can be in one of several possible states. */ @@ -1968,7 +1967,7 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context, const char *peerskey= st->peer_mobile ? "mobile-peers-max" : "static-peers-max"; st->transport_peers_max= dict_read_number( - dict,peerskey,False,"site",loc,DEFAULT_PEERS_MAX); + dict,peerskey,False,"site",loc, st->address ? 4 : 3); if (st->transport_peers_max<1 || st->transport_peers_max>MAX_PEER_ADDRS) { cfgfatal(loc,"site", "%s must be in range 1.." -- 2.30.2