stun

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

commit 465c7e431f386ef0bcc86008a5f525fc60ed2443
parent 0ec79d3e398536b449fca3bda7cd0d6279f39f76
Author: sin <sin@2f30.org>
Date:   Sat,  2 Apr 2016 09:04:28 +0100

simplify code

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

diff --git a/stun.c b/stun.c @@ -647,13 +647,8 @@ serversetup(int devfd) setsockopt(netfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); setsockopt(netfd, IPPROTO_TCP, TCP_NODELAY, (int []){1}, sizeof(int)); - if (challenge(netfd) < 0) { - logwarn("server -> client challenge failed"); - goto err; - } - - if (response(netfd) < 0) { - logwarn("server -> client response failed"); + if (challenge(netfd) < 0 || response(netfd) < 0) { + logwarn("challenge-response failed"); goto err; } @@ -704,13 +699,8 @@ clientsetup(int devfd) if (debug) logdbg("connected to %s:%s", host, port); - if (response(netfd) < 0) { - logwarn("client -> server response failed"); - goto err; - } - - if (challenge(netfd) < 0) { - logwarn("client -> server challenge failed"); + if (response(netfd) < 0 || challenge(netfd) < 0) { + logwarn("challenge-response failed"); goto err; }