Browse Source

- EPOLLET doesn't need checking for previous IO events
(this also fixes io_watch_chg possible invocation of handle_io which would
lead to ugly problems inside tcp handle_tcpconn_ev)

Andrei Pelinescu-Onciul 17 years ago
parent
commit
6e154d5d93
1 changed files with 2 additions and 26 deletions
  1. 2 26
      io_wait.h

+ 2 - 26
io_wait.h

@@ -312,7 +312,7 @@ inline static int io_watch_add(	io_wait_h* h,
 #ifdef HAVE_DEVPOLL
 	struct pollfd pfd;
 #endif
-#if defined(HAVE_SIGIO_RT) || defined (HAVE_EPOLL)
+#if defined(HAVE_SIGIO_RT)
 	int n;
 	int idx;
 	int check_io;
@@ -432,7 +432,6 @@ again2:
 				goto error;
 			}
 			idx=-1;
-			check_io=1;
 			break;
 #endif
 #ifdef HAVE_KQUEUE
@@ -476,7 +475,7 @@ again_devpoll:
 	
 	h->fd_no++; /* "activate" changes, for epoll/kqueue/devpoll it
 				   has only informative value */
-#if defined(HAVE_SIGIO_RT) || defined (HAVE_EPOLL)
+#if defined(HAVE_SIGIO_RT)
 	if (check_io){
 		/* handle possible pre-existing events */
 		pf.fd=fd;
@@ -717,10 +716,6 @@ inline static int io_watch_chg(io_wait_h* h, int fd, short events, int idx )
 #ifdef HAVE_EPOLL
 	int n;
 	struct epoll_event ep_event;
-	struct pollfd pf;
-	int check_io;
-	
-	check_io=0;
 #endif
 	
 	if (unlikely((fd<0) || (fd>=h->max_fd_no))){
@@ -802,7 +797,6 @@ again_epoll_et:
 							" failed: %s [%d]\n", strerror(errno), errno);
 					goto error;
 				}
-			check_io=1;
 			break;
 #endif
 #ifdef HAVE_KQUEUE
@@ -858,24 +852,6 @@ again_devpoll2:
 					h->poll_method);
 			goto error;
 	}
-#if defined (HAVE_EPOLL)
-	if (check_io){
-		/* handle possible pre-existing events, only for EPOLL_ET
-		 * (SIGIO_RT already listen for all the events) */
-		pf.fd=fd;
-		pf.events=add_events;
-check_io_again:
-		n=0;
-		while(e->type && ((n=poll(&pf, 1, 0))>0) && 
-				(handle_io(e, pf.revents, idx)>0) &&
-				(pf.revents & (e->events|POLLERR|POLLHUP)));
-		if (unlikely(e->type && (n==-1))){
-			if (errno==EINTR) goto check_io_again;
-			LOG(L_ERR, "ERROR: io_watch_chg: check_io poll: %s [%d]\n",
-						strerror(errno), errno);
-		}
-	}
-#endif /* HAVE_EPOLL */
 	return 0;
 error:
 	return -1;