]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix off-by-one in the kqueue event assembly code; remove silly extra comments from...
authoradrian <>
Wed, 22 Nov 2006 13:08:32 +0000 (13:08 +0000)
committeradrian <>
Wed, 22 Nov 2006 13:08:32 +0000 (13:08 +0000)
src/comm_kqueue.cc

index f6bbd4a0828f0bcf987fbe2bac4233ecb2abae8f..37f18bf546f78021174bdebf84332b821e30830f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_kqueue.cc,v 1.12 2006/09/02 10:43:10 adrian Exp $
+ * $Id: comm_kqueue.cc,v 1.13 2006/11/22 06:08:32 adrian Exp $
  *
  * DEBUG: section 5    Socket functions
  *
@@ -100,11 +100,6 @@ kq_update_events(int fd, short filter, PF * handler)
     PF *cur_handler;
     int kep_flags;
 
-#if 0
-
-    int retval;
-#endif
-
     switch (filter) {
 
     case EVFILT_READ:
@@ -136,10 +131,11 @@ kq_update_events(int fd, short filter, PF * handler)
 
         EV_SET(kep, (uintptr_t) fd, filter, kep_flags, 0, 0, 0);
 
-        if (kqoff == kqmax) {
+       /* Check if we've used the last one. If we have then submit them all */
+        if (kqoff == kqmax - 1) {
             int ret;
 
-            ret = kevent(kq, kqlst, kqoff, NULL, 0, &zero_timespec);
+            ret = kevent(kq, kqlst, kqmax, NULL, 0, &zero_timespec);
             /* jdc -- someone needs to do error checking... */
 
             if (ret == -1) {
@@ -151,18 +147,6 @@ kq_update_events(int fd, short filter, PF * handler)
         } else {
             kqoff++;
         }
-
-#if 0
-        if (retval < 0) {
-            /* Error! */
-
-            if (ke.flags & EV_ERROR) {
-                errno = ke.data;
-            }
-        }
-
-#endif
-
     }
 }
 
@@ -249,12 +233,6 @@ comm_select(int msec)
 
     struct timespec poll_time;
 
-    /*
-     * remember we are doing NANOseconds here, not micro/milli. God knows
-     * why jlemon used a timespec, but hey, he wrote the interface, not I
-     *   -- Adrian
-     */
-
     if (msec > max_poll_time)
         msec = max_poll_time;