stun

simple point to point tunnel
git clone git://git.2f30.org/stun.git
Log | Files | Refs | README

commit 43f7c2ff10f634225ec3e99cec45ca74beacac30
parent 4bbb3dc4bea9a44bcd868d8460e3b7e54d115d99
Author: sin <sin@2f30.org>
Date:   Sat Apr 30 18:17:54 +0100

Don't tie auth timeout to reconnection timeout

Diffstat:
auth.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/auth.c b/auth.c @@ -16,9 +16,8 @@ challenge(int netfd) size_t outlen; struct pollfd pfd[1]; uint64_t n, reply; - int ret, timeout; + int ret; - timeout = MIN(AUTHTIMEO, netconfig.timeout); arc4random_buf(&n, sizeof(buf)); pack64(buf, n); if (netwrite(netfd, buf, sizeof(buf), &outlen) == PKTFAILED) @@ -27,7 +26,7 @@ challenge(int netfd) pfd[0].fd = netfd; pfd[0].events = POLLIN; for (;;) { - ret = poll(pfd, 1, timeout * 1000); + ret = poll(pfd, 1, AUTHTIMEO * 1000); if (ret < 0) { if (errno == EINTR) continue; @@ -61,13 +60,12 @@ response(int netfd) size_t outlen; struct pollfd pfd[1]; uint64_t reply; - int ret, timeout; + int ret; - timeout = MIN(AUTHTIMEO, netconfig.timeout); pfd[0].fd = netfd; pfd[0].events = POLLIN; for (;;) { - ret = poll(pfd, 1, timeout * 1000); + ret = poll(pfd, 1, AUTHTIMEO * 1000); if (ret < 0) { if (errno == EINTR) continue;