RE: [squid-users] bug 1991/1939 and kqueue

From: Ming Fu <Ming.Fu_at_watchguard.com>
Date: Thu, 12 May 2011 17:19:35 +0000

Hi,

Here is a patch for bug 1991 on FreeBSD compiled with kqueue. It fixed the websites that previously won't load through sslbump on FreeBSD with kqueue enabled.

--- /home/fming/work/squid-3.1.12.1-20110506/src/comm_kqueue.cc 2011-05-06 00:27:39.000000000 -0400
+++ comm_kqueue.cc 2011-05-12 10:03:49.000000000 -0400
@@ -198,7 +198,11 @@
     assert(F->flags.open);
 
     if (type & COMM_SELECT_READ) {
+ if (F->flags.read_pending)
+ kq_update_events(fd, EVFILT_WRITE, handler);
+
         kq_update_events(fd, EVFILT_READ, handler);
+
         F->read_handler = handler;
         F->read_data = client_data;
     }
@@ -291,31 +295,24 @@
             continue; /* XXX! */
         }
 
- switch (ke[i].filter) {
-
- case EVFILT_READ:
-
+ if (ke[i].filter == EVFILT_READ || F->flags.read_pending) {
             if ((hdl = F->read_handler) != NULL) {
                 F->read_handler = NULL;
                 F->flags.read_pending = 0;
                 hdl(fd, F->read_data);
             }
+ }
 
- break;
-
- case EVFILT_WRITE:
-
+ if (ke[i].filter == EVFILT_WRITE) {
             if ((hdl = F->write_handler) != NULL) {
                 F->write_handler = NULL;
                 hdl(fd, F->write_data);
             }
+ }
 
- break;
-
- default:
- /* Bad! -- adrian */
+ if (ke[i].filter != EVFILT_WRITE && ke[i].filter != EVFILT_READ) {
+ /* Bad! -- adrian */
             debugs(5, 1, "comm_select: kevent returned " << ke[i].filter << "!");
- break;
         }
     }
Received on Thu May 12 2011 - 17:19:40 MDT

This archive was generated by hypermail 2.2.0 : Fri May 13 2011 - 12:00:03 MDT