Fixed: Failed connect may result in success response on some Windows versions

This commit is contained in:
Vladimir Dubrovin 2025-08-05 17:38:38 +03:00
parent 6916cea4eb
commit e525ce913e

View File

@ -488,8 +488,8 @@ int connectwithpoll(struct clientparam *param, SOCKET sock, struct sockaddr *sa,
if(!errno) return 0; if(!errno) return 0;
memset(fds, 0, sizeof(fds)); memset(fds, 0, sizeof(fds));
fds[0].fd = sock; fds[0].fd = sock;
fds[0].events = POLLOUT|POLLIN; 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)) { 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 (13);
} }
return 0; return 0;