--------------------- PatchSet 7131 Date: 2005/10/26 02:55:34 Author: adri Branch: tidyup_deferred_reads Tag: (none) Log: refactor the client side read IO scheduling stuff slightly in preparation for the removal of the commDefer() handler. Members: src/client_side.c:1.47.2.59.4.6->1.47.2.59.4.7 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.59.4.6 retrieving revision 1.47.2.59.4.7 diff -u -r1.47.2.59.4.6 -r1.47.2.59.4.7 --- squid/src/client_side.c 25 Oct 2005 09:23:37 -0000 1.47.2.59.4.6 +++ squid/src/client_side.c 26 Oct 2005 02:55:34 -0000 1.47.2.59.4.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.59.4.6 2005/10/25 09:23:37 adri Exp $ + * $Id: client_side.c,v 1.47.2.59.4.7 2005/10/26 02:55:34 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2173,7 +2173,7 @@ * blocking!. */ #ifdef _SQUID_CYGWIN_ - commSetSelect(conn->fd, COMM_SELECT_READ, clientReadRequest, conn, 0); + clientReadSchedule(conn); #else clientReadRequest(conn->fd, conn); /* Read next request */ #endif @@ -2961,6 +2961,18 @@ } static void +clientReadSchedule(ConnStateData *conn) +{ + commSetSelect(conn->fd, COMM_SELECT_READ, clientReadRequest, conn, 0); +} + +static void +clientReadClear(ConnStateData *conn) +{ + commSetSelect(conn->fd, COMM_SELECT_READ, NULL, NULL, 0); +} + +static void clientReadRequest(int fd, void *data) { ConnStateData *conn = data; @@ -2976,7 +2988,7 @@ fde *F = &fd_table[fd]; int len = conn->in.size - conn->in.offset - 1; debug(33, 4) ("clientReadRequest: FD %d: reading request...\n", fd); - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); + clientReadSchedule(conn); if (len == 0) { /* Grow the request memory area to accomodate for a large request */ conn->in.size += CLIENT_REQ_BUF_SZ; @@ -3211,7 +3223,7 @@ } if (request->method == METHOD_CONNECT) { /* Stop reading requests... */ - commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); + clientReadClear(conn); if (conn->chr == http) clientAccessCheck(http); else { @@ -3454,7 +3466,7 @@ /* * Aha, but we don't want a read handler! */ - commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); + clientReadClear(conn); } #else /* @@ -3543,7 +3555,7 @@ if (aclCheckFast(Config.accessList.identLookup, &identChecklist)) identStart(&me, &peer, clientIdentDone, connState); #endif - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, connState, 0); + clientReadSchedule(connState); commSetDefer(fd, clientReadDefer, connState); clientdbEstablished(peer.sin_addr, 1); assert(N); @@ -3590,8 +3602,7 @@ } else { debug(83, 5) ("clientNegotiateSSL: FD %d has no certificate.\n", fd); } - - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); + clientReadSchedule(conn); } struct _https_port_data {