From d45840bd28f5cf604d320ab9ff308ba7ba8c0b28 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 21 Jun 2013 08:20:19 +0200 Subject: [PATCH 3/9] 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. (cherry picked from commit 8615c2af67dc2be07bdb246ed13130fe7d32e3d1) --- src/session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/session.c b/src/session.c index 21ecb9f..9ed932c 100644 --- a/src/session.c +++ b/src/session.c @@ -1370,8 +1370,11 @@ resync_stream_interface: buffer_shutw_now(s->req); /* shutdown(write) pending */ - if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_OUT_EMPTY)) == (BF_SHUTW_NOW|BF_OUT_EMPTY))) + if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_OUT_EMPTY)) == (BF_SHUTW_NOW|BF_OUT_EMPTY))) { + if (s->req->flags & BF_READ_ERROR) + s->req->cons->flags |= SI_FL_NOLINGER; s->req->cons->shutw(s->req->cons); + } /* shutdown(write) done on server side, we must stop the client too */ if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTW && -- 1.8.1.5