Browse code

- 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 authored on 10/01/2008 15:16:34
Showing 1 changed files
... ...
@@ -312,7 +312,7 @@ inline static int io_watch_add(	io_wait_h* h,
312 312
 #ifdef HAVE_DEVPOLL
313 313
 	struct pollfd pfd;
314 314
 #endif
315
-#if defined(HAVE_SIGIO_RT) || defined (HAVE_EPOLL)
315
+#if defined(HAVE_SIGIO_RT)
316 316
 	int n;
317 317
 	int idx;
318 318
 	int check_io;
... ...
@@ -432,7 +432,6 @@ again2:
432 432
 				goto error;
433 433
 			}
434 434
 			idx=-1;
435
-			check_io=1;
436 435
 			break;
437 436
 #endif
438 437
 #ifdef HAVE_KQUEUE
... ...
@@ -476,7 +475,7 @@ again_devpoll:
476 475
 	
477 476
 	h->fd_no++; /* "activate" changes, for epoll/kqueue/devpoll it
478 477
 				   has only informative value */
479
-#if defined(HAVE_SIGIO_RT) || defined (HAVE_EPOLL)
478
+#if defined(HAVE_SIGIO_RT)
480 479
 	if (check_io){
481 480
 		/* handle possible pre-existing events */
482 481
 		pf.fd=fd;
... ...
@@ -717,10 +716,6 @@ inline static int io_watch_chg(io_wait_h* h, int fd, short events, int idx )
717 716
 #ifdef HAVE_EPOLL
718 717
 	int n;
719 718
 	struct epoll_event ep_event;
720
-	struct pollfd pf;
721
-	int check_io;
722
-	
723
-	check_io=0;
724 719
 #endif
725 720
 	
726 721
 	if (unlikely((fd<0) || (fd>=h->max_fd_no))){
... ...
@@ -802,7 +797,6 @@ again_epoll_et:
802 797
 							" failed: %s [%d]\n", strerror(errno), errno);
803 798
 					goto error;
804 799
 				}
805
-			check_io=1;
806 800
 			break;
807 801
 #endif
808 802
 #ifdef HAVE_KQUEUE
... ...
@@ -858,24 +852,6 @@ again_devpoll2:
858 852
 					h->poll_method);
859 853
 			goto error;
860 854
 	}
861
-#if defined (HAVE_EPOLL)
862
-	if (check_io){
863
-		/* handle possible pre-existing events, only for EPOLL_ET
864
-		 * (SIGIO_RT already listen for all the events) */
865
-		pf.fd=fd;
866
-		pf.events=add_events;
867
-check_io_again:
868
-		n=0;
869
-		while(e->type && ((n=poll(&pf, 1, 0))>0) && 
870
-				(handle_io(e, pf.revents, idx)>0) &&
871
-				(pf.revents & (e->events|POLLERR|POLLHUP)));
872
-		if (unlikely(e->type && (n==-1))){
873
-			if (errno==EINTR) goto check_io_again;
874
-			LOG(L_ERR, "ERROR: io_watch_chg: check_io poll: %s [%d]\n",
875
-						strerror(errno), errno);
876
-		}
877
-	}
878
-#endif /* HAVE_EPOLL */
879 855
 	return 0;
880 856
 error:
881 857
 	return -1;