[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.
diff --git a/src/proto_http.c b/src/proto_http.c
index e6d610f..e9b3b56 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -444,7 +444,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 7d2aa30..2a7275b 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -134,7 +134,10 @@
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;
}