mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
select: align poll emulation to return all relevant events
The poll emulation via select already consumes POLLRDNORM, POLLWRNORM and POLLRDBAND as input events. Therefore it should also return them as output events if signaled. Also fix indentation in input event handling block. Assisted-by: Jay Satiro Reviewed-by: Daniel Stenberg Replaces #5852 Closes #5883
This commit is contained in:
parent
ce56cc8b11
commit
20d74b7393
28
lib/select.c
28
lib/select.c
@ -378,7 +378,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||||||
if(ufds[i].revents & POLLHUP)
|
if(ufds[i].revents & POLLHUP)
|
||||||
ufds[i].revents |= POLLIN;
|
ufds[i].revents |= POLLIN;
|
||||||
if(ufds[i].revents & POLLERR)
|
if(ufds[i].revents & POLLERR)
|
||||||
ufds[i].revents |= (POLLIN|POLLOUT);
|
ufds[i].revents |= POLLIN|POLLOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* HAVE_POLL_FINE */
|
#else /* HAVE_POLL_FINE */
|
||||||
@ -394,7 +394,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||||||
continue;
|
continue;
|
||||||
VERIFY_SOCK(ufds[i].fd);
|
VERIFY_SOCK(ufds[i].fd);
|
||||||
if(ufds[i].events & (POLLIN|POLLOUT|POLLPRI|
|
if(ufds[i].events & (POLLIN|POLLOUT|POLLPRI|
|
||||||
POLLRDNORM|POLLWRNORM|POLLRDBAND)) {
|
POLLRDNORM|POLLWRNORM|POLLRDBAND)) {
|
||||||
if(ufds[i].fd > maxfd)
|
if(ufds[i].fd > maxfd)
|
||||||
maxfd = ufds[i].fd;
|
maxfd = ufds[i].fd;
|
||||||
if(ufds[i].events & (POLLRDNORM|POLLIN))
|
if(ufds[i].events & (POLLRDNORM|POLLIN))
|
||||||
@ -421,12 +421,24 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||||||
ufds[i].revents = 0;
|
ufds[i].revents = 0;
|
||||||
if(ufds[i].fd == CURL_SOCKET_BAD)
|
if(ufds[i].fd == CURL_SOCKET_BAD)
|
||||||
continue;
|
continue;
|
||||||
if(FD_ISSET(ufds[i].fd, &fds_read))
|
if(FD_ISSET(ufds[i].fd, &fds_read)) {
|
||||||
ufds[i].revents |= POLLIN;
|
if(ufds[i].events & POLLRDNORM)
|
||||||
if(FD_ISSET(ufds[i].fd, &fds_write))
|
ufds[i].revents |= POLLRDNORM;
|
||||||
ufds[i].revents |= POLLOUT;
|
if(ufds[i].events & POLLIN)
|
||||||
if(FD_ISSET(ufds[i].fd, &fds_err))
|
ufds[i].revents |= POLLIN;
|
||||||
ufds[i].revents |= POLLPRI;
|
}
|
||||||
|
if(FD_ISSET(ufds[i].fd, &fds_write)) {
|
||||||
|
if(ufds[i].events & POLLWRNORM)
|
||||||
|
ufds[i].revents |= POLLWRNORM;
|
||||||
|
if(ufds[i].events & POLLOUT)
|
||||||
|
ufds[i].revents |= POLLOUT;
|
||||||
|
}
|
||||||
|
if(FD_ISSET(ufds[i].fd, &fds_err)) {
|
||||||
|
if(ufds[i].events & POLLRDBAND)
|
||||||
|
ufds[i].revents |= POLLRDBAND;
|
||||||
|
if(ufds[i].events & POLLPRI)
|
||||||
|
ufds[i].revents |= POLLPRI;
|
||||||
|
}
|
||||||
if(ufds[i].revents != 0)
|
if(ufds[i].revents != 0)
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user