From: Willy Tarreau Date: Fri, 21 Jun 2013 06:20:19 +0000 (+0200) Subject: MEDIUM: session: disable lingering on the server when the client aborts X-Git-Tag: v1.5-dev20~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8615c2af67dc2be07bdb246ed13130fe7d32e3d1;p=thirdparty%2Fhaproxy.git MEDIUM: session: disable lingering on the server when the client aborts When abortonclose is used and an error is detected on the client side, better force an RST to the server. That way we propagate to the server the same vision we got from the client, and we ensure that we won't keep TIME_WAITs. --- diff --git a/src/session.c b/src/session.c index d967b2bbf7..004f293c00 100644 --- a/src/session.c +++ b/src/session.c @@ -2139,8 +2139,11 @@ struct task *process_session(struct task *t) /* shutdown(write) pending */ if (unlikely((s->req->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW && - channel_is_empty(s->req))) + channel_is_empty(s->req))) { + if (s->req->flags & CF_READ_ERROR) + s->req->cons->flags |= SI_FL_NOLINGER; si_shutw(s->req->cons); + } /* shutdown(write) done on server side, we must stop the client too */ if (unlikely((s->req->flags & (CF_SHUTW|CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTW &&