From c88ea68ef18b3f5788285420f4d8a51fefa274ca Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 29 Dec 2009 14:56:36 +0100 Subject: [PATCH] [MEDIUM] http: add some SI_FL_NOLINGER around server errors When we catch an error from the server, speed up the connection abort since we don't want to remain long with pending data in the socket, and we want to be able to reuse our source port ASAP. --- src/proto_http.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/proto_http.c b/src/proto_http.c index 3a5f14100..791d52e3f 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -3502,6 +3502,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) rep->analysers = 0; txn->status = 502; + rep->prod->flags |= SI_FL_NOLINGER; stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502)); if (!(s->flags & SN_ERR_MASK)) @@ -3530,6 +3531,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) rep->analysers = 0; txn->status = 502; + rep->prod->flags |= SI_FL_NOLINGER; stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502)); if (!(s->flags & SN_ERR_MASK)) @@ -3552,6 +3554,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) rep->analysers = 0; txn->status = 504; + rep->prod->flags |= SI_FL_NOLINGER; stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_504)); if (!(s->flags & SN_ERR_MASK)) @@ -3574,6 +3577,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) rep->analysers = 0; txn->status = 502; + rep->prod->flags |= SI_FL_NOLINGER; stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502)); if (!(s->flags & SN_ERR_MASK)) @@ -3970,6 +3974,7 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s return_srv_prx_502: rep->analysers = 0; txn->status = 502; + rep->prod->flags |= SI_FL_NOLINGER; stream_int_retnclose(rep->cons, error_message(t, HTTP_ERR_502)); if (!(t->flags & SN_ERR_MASK)) t->flags |= SN_ERR_PRXCOND;