commit 56afddb187a053bd3fa6e26fb7deb1b6403672f9
parent 0ae9423d7c9b6a3ac2efc064bc5e977b0ef8a6ee
Author: sin <sin@2f30.org>
Date: Sat, 26 Mar 2016 10:52:16 +0000
make it clear that connection is dropped
Diffstat:
M | stun.c | | | 18 | ++++++------------ |
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/stun.c b/stun.c
@@ -569,22 +569,19 @@ serversetup(int devfd)
/* challenge client */
ret = challenge(netfd);
if (ret < 0) {
- aesterm(&enc, &dec);
- close(netfd);
logwarn("server -> client challenge failed");
- continue;
+ goto err;
}
/* respond to client's challenge */
ret = response(netfd);
if (ret < 0) {
- aesterm(&enc, &dec);
- close(netfd);
logwarn("server -> client response failed");
- continue;
+ goto err;
}
tunnel(netfd, devfd);
+err:
aesterm(&enc, &dec);
close(netfd);
if (debug)
@@ -630,24 +627,21 @@ clientsetup(int devfd)
/* respond to server's challenge */
ret = response(netfd);
if (ret < 0) {
- aesterm(&enc, &dec);
- close(netfd);
logwarn("client -> server response failed");
- return -1;
+ goto err;
}
/* challenge server */
ret = challenge(netfd);
if (ret < 0) {
- aesterm(&enc, &dec);
- close(netfd);
logwarn("client -> server challenge failed");
- return -1;
+ goto err;
}
if (debug)
logdbg("connected to %s:%s", host, port);
ret = tunnel(netfd, devfd);
+err:
logwarn("connection to %s:%s dropped", host, port);
aesterm(&enc, &dec);
close(netfd);