From 9f195293de7408f3baaa7e07e22d1f98549fcd59 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 15 Apr 2007 21:26:58 +0200 Subject: [PATCH] [MAJOR] remove useless calls to shutdown(SHUT_RD) shutdown(SHUT_RD) is useless on data TCP sockets. It does nothing and consumes one syscall. Remove it. --- src/proto_http.c | 6 ------ src/stream_sock.c | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/proto_http.c b/src/proto_http.c index e6d610f31..e9b3b56a3 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -444,7 +444,6 @@ void client_retnclose(struct session *s, const struct chunk *msg) tv_delayfrom(&s->rep->wex, &now, s->fe->clitimeout); else tv_eternity(&s->rep->wex); - shutdown(s->cli_fd, SHUT_RD); s->cli_state = CL_STSHUTR; buffer_flush(s->rep); if (msg->len) @@ -1964,7 +1963,6 @@ int process_cli(struct session *t) else if (req->flags & BF_READ_NULL || s == SV_STSHUTW || s == SV_STCLOSE) { EV_FD_CLR(t->cli_fd, DIR_RD); tv_eternity(&req->rex); - shutdown(t->cli_fd, SHUT_RD); t->cli_state = CL_STSHUTR; return 1; } @@ -1986,7 +1984,6 @@ int process_cli(struct session *t) else if (tv_cmp2_ms(&req->rex, &now) <= 0) { EV_FD_CLR(t->cli_fd, DIR_RD); tv_eternity(&req->rex); - shutdown(t->cli_fd, SHUT_RD); t->cli_state = CL_STSHUTR; if (!(t->flags & SN_ERR_MASK)) t->flags |= SN_ERR_CLITO; @@ -2556,7 +2553,6 @@ int process_srv(struct session *t) rep->l >= rep->rlim - rep->data)) { EV_FD_CLR(t->srv_fd, DIR_RD); tv_eternity(&rep->rex); - shutdown(t->srv_fd, SHUT_RD); t->srv_state = SV_STSHUTR; //fprintf(stderr,"%p:%s(%d), c=%d, s=%d\n", t, __FUNCTION__, __LINE__, t->cli_state, t->cli_state); return 1; @@ -3000,7 +2996,6 @@ int process_srv(struct session *t) else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE) { EV_FD_CLR(t->srv_fd, DIR_RD); tv_eternity(&rep->rex); - shutdown(t->srv_fd, SHUT_RD); t->srv_state = SV_STSHUTR; //fprintf(stderr,"%p:%s(%d), c=%d, s=%d\n", t, __FUNCTION__, __LINE__, t->cli_state, t->cli_state); return 1; @@ -3023,7 +3018,6 @@ int process_srv(struct session *t) else if (tv_cmp2_ms(&rep->rex, &now) <= 0) { EV_FD_CLR(t->srv_fd, DIR_RD); tv_eternity(&rep->rex); - shutdown(t->srv_fd, SHUT_RD); t->srv_state = SV_STSHUTR; if (!(t->flags & SN_ERR_MASK)) t->flags |= SN_ERR_SRVTO; diff --git a/src/stream_sock.c b/src/stream_sock.c index 7d2aa3035..2a7275baa 100644 --- a/src/stream_sock.c +++ b/src/stream_sock.c @@ -134,7 +134,10 @@ int stream_sock_read(int fd) { retval = 1; // connection closed break; } - else if (errno == EAGAIN) {/* ignore EAGAIN */ + else if (errno == EAGAIN) { + /* Ignore EAGAIN but inform the poller that there is + * nothing to read left. + */ retval = 0; break; }