stun

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

commit 8c2c0b16d73e97ccdaca575814e106201f50053e
parent 9e3f07eb65c6fd27659350bd84da225b74ba8ace
Author: sin <sin@2f30.org>
Date:   Wed, 23 Mar 2016 16:51:11 +0000

reconnect every second regardless

Diffstat:
Mstun.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/stun.c b/stun.c @@ -583,15 +583,19 @@ clientsetup(int devfd) } break; } - if (!p) - logerr("failed to connect to %s:%s", host, port); freeaddrinfo(ai); + if (!p) { + logwarn("failed to connect to %s:%s", host, port); + return -1; + } setsockopt(netfd, IPPROTO_TCP, TCP_NODELAY, (int []){1}, sizeof(int)); ret = response(netfd); - if (ret < 0) - logerr("failed to respond to challenge"); + if (ret < 0) { + logwarn("failed to respond to challenge"); + return -1; + } ret = tunnel(netfd, devfd); logwarn("connection to %s:%s dropped", host, port);