From e525ce913e264c726a27bc6ae84f3d2861eab786 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Tue, 5 Aug 2025 17:38:38 +0300 Subject: [PATCH] Fixed: Failed connect may result in success response on some Windows versions --- src/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common.c b/src/common.c index abffdf2..29ecfa1 100644 --- a/src/common.c +++ b/src/common.c @@ -488,8 +488,8 @@ int connectwithpoll(struct clientparam *param, SOCKET sock, struct sockaddr *sa, if(!errno) return 0; memset(fds, 0, sizeof(fds)); fds[0].fd = sock; - fds[0].events = POLLOUT|POLLIN; - if((param?param->srv->so._poll(param->sostate, fds, 1, to*1000):so._poll(so.state, fds, 1, to*1000)) <= 0 || !(fds[0].revents & POLLOUT)) { + fds[0].events = POLLOUT|POLLIN|POLLERR|POLLHUP; + if((param?param->srv->so._poll(param->sostate, fds, 1, to*1000):so._poll(so.state, fds, 1, to*1000)) <= 0 || !(fds[0].revents & POLLOUT) || (fds[0].revents & (POLLERR|POLLHUP))) { return (13); } return 0;