[or-cvs] Clear revents even when no events are received. Also, sinc...

Nick Mathewson nickm at seul.org
Tue Oct 7 21:16:06 UTC 2003


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv17954

Modified Files:
	fakepoll.c 
Log Message:
Clear revents even when no events are received.  Also, since everyone gets in exceptions, everyone gets to increment maxfd.

Index: fakepoll.c
===================================================================
RCS file: /home/or/cvsroot/src/common/fakepoll.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- fakepoll.c	7 Oct 2003 20:45:16 -0000	1.10
+++ fakepoll.c	7 Oct 2003 21:16:04 -0000	1.11
@@ -49,12 +49,12 @@
 
 	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 @@
 	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))



More information about the tor-commits mailing list