aboutsummaryrefslogtreecommitdiff
path: root/src/transport/zerotier/zerotier.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-07 17:06:16 -0800
committerGarrett D'Amore <garrett@damore.org>2018-03-07 17:12:53 -0800
commit8a20acfa34e1eedf34254354b8a219bd8fbca2ed (patch)
tree66d8860b7576ebd6f1fa24c9042e929fb7848c93 /src/transport/zerotier/zerotier.h
parent52ee317a007ad973a091b9cbd69e1b8ef29904ee (diff)
downloadnng-8a20acfa34e1eedf34254354b8a219bd8fbca2ed.tar.gz
nng-8a20acfa34e1eedf34254354b8a219bd8fbca2ed.tar.bz2
nng-8a20acfa34e1eedf34254354b8a219bd8fbca2ed.zip
fixes #269 nngcat unreliable with ZeroTier transport
This does a few things. First it closes a case where a dropped message could prevent subsequent connection attempts from getting through. Second, it changes the rate at which we retry, and the timeout, to be a lot more aggressive when attempting to establish a connection. We retry every 500 ms, for up to 2 minutes, before giving up. This gives a lot more resilience in the face of message loss that is typical of ZeroTier in some environments when first establishing communication. Third, makes the values for the connection attempts *tunable*, so that applications can adjust for different deployment scenarios. Fourth, it includes the ability to get the UDP socket name. This was needed during some debug, and may be useful for a real UDP transport later, so we're keeping it. Finally, we added documentation for the above items.
Diffstat (limited to 'src/transport/zerotier/zerotier.h')
-rw-r--r--src/transport/zerotier/zerotier.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/transport/zerotier/zerotier.h b/src/transport/zerotier/zerotier.h
index 9083f665..a191b106 100644
--- a/src/transport/zerotier/zerotier.h
+++ b/src/transport/zerotier/zerotier.h
@@ -78,7 +78,7 @@
// is presented as an ASCIIZ string.
#define NNG_OPT_ZT_NETWORK_NAME "zt:network-name"
-// NNG_OPT_ZT_PING_TIME and NNG_OPT_ZT_PING_COUNT are used to send ping
+// NNG_OPT_ZT_PING_TIME and NNG_OPT_ZT_PING_TRIES are used to send ping
// requests when a connection appears to be idled. If a logical session
// has not received traffic from it's peer for ping-time, then a ping packet
// is sent. This will be done up to ping-count times. If no traffic from
@@ -88,7 +88,15 @@
// NNG_OPT_ZT_PING_COUNT is an integer.) This ping process can be disabled
// by setting either ping-time or ping-count to zero.
#define NNG_OPT_ZT_PING_TIME "zt:ping-time"
-#define NNG_OPT_ZT_PING_COUNT "zt:ping-count"
+#define NNG_OPT_ZT_PING_TRIES "zt:ping-tries"
+
+// NNG_OPT_ZT_CONN_TIME and NNG_OPT_ZT_CONN_TRIES are used to control
+// the interval between connection attempts, and the maximum number of
+// connection attempts to make before assuming that the peer is absent
+// (and returning NNG_ETIMEDOUT). The NNG_OPT_ZT_CONN_TIME is a duration,
+// the NNG_OPT_ZT_CONN_TRIES is an integer.
+#define NNG_OPT_ZT_CONN_TIME "zt:conn-time"
+#define NNG_OPT_ZT_CONN_TRIES "zt:conn-tries"
// NNG_OPT_ZT_MTU is a read-only size_t and contains the ZeroTier virtual
// network MTU (i.e. the L2 payload MTU). Messages that are larger than this