warp-vpn

point to point VPN implementation
git clone git://git.2f30.org/warp-vpn
Log | Files | Refs | README

commit 89e9737ae3c83768237e160f9b753f107f3192f0
parent 9d5a89800621d7a196ac710ae7332d340fc9e99c
Author: sin <sin@2f30.org>
Date:   Thu, 31 Mar 2016 17:43:04 +0100

add timeout for challenge response

Diffstat:
Mstun.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stun.c b/stun.c @@ -535,10 +535,12 @@ challenge(int netfd) for (;;) { pfd[0].fd = netfd; pfd[0].events = POLLIN; - ret = poll(pfd, 1, -1); + ret = poll(pfd, 1, RCVTIMEO); if (ret < 0) { logwarn("poll failed"); return -1; + } else if (ret == 0) { + return -1; } if (pfd[0].revents & (POLLERR | POLLNVAL))