--------------------- PatchSet 7133 Date: 2005/10/26 03:46:26 Author: adri Branch: tidyup_deferred_reads Tag: (none) Log: Hah, this was easier than I thought. Just check in clientReadRequest() if we need to do the defer and, if we do, reschedule the read for a second from now. This basically mimics the behaviour in the epoll dev branch for situations like this where there's no way to 'kick' the defer - as he's checking defer handlers once a second to see whether they still need to be deferred. Yay, this is the last defer handler. Members: src/client_side.c:1.47.2.59.4.8->1.47.2.59.4.9 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.59.4.8 retrieving revision 1.47.2.59.4.9 diff -u -r1.47.2.59.4.8 -r1.47.2.59.4.9 --- squid/src/client_side.c 26 Oct 2005 03:00:13 -0000 1.47.2.59.4.8 +++ squid/src/client_side.c 26 Oct 2005 03:46:26 -0000 1.47.2.59.4.9 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.59.4.8 2005/10/26 03:00:13 adri Exp $ + * $Id: client_side.c,v 1.47.2.59.4.9 2005/10/26 03:46:26 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2991,6 +2991,11 @@ fde *F = &fd_table[fd]; int len = conn->in.size - conn->in.offset - 1; debug(33, 4) ("clientReadRequest: FD %d: reading request...\n", fd); + if (clientReadDefer(conn->fd, conn)) { + /* We're reading too fast - back off for a second */ + commDeferReadUntil(conn->fd, 1, clientReadRequest, conn); + return; + } clientReadSchedule(conn); if (len == 0) { /* Grow the request memory area to accomodate for a large request */ @@ -3061,6 +3066,11 @@ cbdataUnlock(conn); return; } + if (clientReadDefer(conn->fd, conn)) { + /* We're reading too fast - back off for a second */ + commDeferReadUntil(conn->fd, 1, clientReadRequest, conn); + return; + } } /* Process next request */ while (conn->in.offset > 0 && conn->body.size_left == 0) { @@ -3559,7 +3569,6 @@ identStart(&me, &peer, clientIdentDone, connState); #endif clientReadSchedule(connState); - commSetDefer(fd, clientReadDefer, connState); clientdbEstablished(peer.sin_addr, 1); assert(N); (*N)++; @@ -3680,7 +3689,6 @@ identStart(&me, &peer, clientIdentDone, connState); #endif commSetSelect(fd, COMM_SELECT_READ, clientNegotiateSSL, connState, 0); - commSetDefer(fd, clientReadDefer, connState); clientdbEstablished(peer.sin_addr, 1); (*N)++; }