From 6d3caf237dbef48b8c5e4c7caefd9f6ea7337e35 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 15 Nov 1997 00:20:13 +0000 Subject: [PATCH] In clientReadRequest(), moved reinstalling the read handler with commSetSelect() to just after the read(). Due to another bug, there was a problem in clientReadRequest that we called commSetSelect() on a FD which had been closed. --- src/client_side.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/client_side.cc b/src/client_side.cc index 05c4edb761..727a03bcf2 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.150 1997/11/14 15:49:58 wessels Exp $ + * $Id: client_side.cc,v 1.151 1997/11/14 17:20:13 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1506,6 +1506,7 @@ clientReadRequest(int fd, void *data) debug(12, 4) ("clientReadRequest: FD %d: reading request...\n", fd); size = read(fd, conn->in.buf + conn->in.offset, len); fd_bytes(fd, size, FD_READ); + commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, Config.Timeout.read); if (size == 0) { if (conn->chr == NULL) { @@ -1518,12 +1519,9 @@ clientReadRequest(int fd, void *data) EBIT_SET(F->flags, FD_SOCKET_EOF); conn->defer.until = squid_curtime + 1; conn->defer.n++; - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); return; } else if (size < 0) { - if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) { - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); - } else { + if (!ignoreErrno(errno)) { debug(50, 2) ("clientReadRequest: FD %d: %s\n", fd, xstrerror()); comm_close(fd); } @@ -1594,7 +1592,6 @@ clientReadRequest(int fd, void *data) } break; } - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); continue; /* while offset > 0 */ } else if (parser_return_code == 0) { /* @@ -1624,7 +1621,6 @@ clientReadRequest(int fd, void *data) conn->in.offset, conn->in.size); k = conn->in.size - 1 - conn->in.offset; } - commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0); break; } else { /* parser returned -1 */ -- 2.47.3