aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-10-07 21:16:04 +0000
committerNick Mathewson <nickm@torproject.org>2003-10-07 21:16:04 +0000
commit3d7463d2b3183b3eb656271a75c14e34d771b3f9 (patch)
treeee0880282c441caa0b7c51b338989df61f87eb64
parent74e6c03cab0575b29831e468b98f2349dc8a8816 (diff)
downloadtor-3d7463d2b3183b3eb656271a75c14e34d771b3f9.tar
tor-3d7463d2b3183b3eb656271a75c14e34d771b3f9.tar.gz
Clear revents even when no events are received. Also, since everyone gets in exceptions, everyone gets to increment maxfd.
svn:r550
-rw-r--r--src/common/fakepoll.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/fakepoll.c b/src/common/fakepoll.c
index bfe707d39..cca6e4421 100644
--- a/src/common/fakepoll.c
+++ b/src/common/fakepoll.c
@@ -49,12 +49,12 @@ poll(struct pollfd *ufds, unsigned int nfds, int timeout)
maxfd = -1;
for (idx = 0; idx < nfds; ++idx) {
+ ufds[idx].revents = 0;
fd = ufds[idx].fd;
- if (ufds[idx].events) {
- if (fd > maxfd)
- maxfd = fd;
+ if (fd > maxfd) {
+ maxfd = fd;
#ifdef MS_WINDOWS
- any_fds_set = 1;
+ any_fds_set = 1;
#endif
}
if (ufds[idx].events & POLLIN)
@@ -76,7 +76,6 @@ poll(struct pollfd *ufds, unsigned int nfds, int timeout)
r = 0;
for (idx = 0; idx < nfds; ++idx) {
fd = ufds[idx].fd;
- ufds[idx].revents = 0;
if (FD_ISSET(fd, &readfds))
ufds[idx].revents |= POLLIN;
if (FD_ISSET(fd, &writefds))