From 38c99bcb98f36a7a7bcef08882b8505c66f6b600 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 22 Feb 2009 15:58:45 +0100 Subject: [PATCH] [BUG] fix unix socket processing of interrupted output Unix socket processing was still quite buggy. It did not properly handle interrupted output due to a full response buffer. The fix mainly consists in not trying to prematurely enable write on the response buffer, just like the standard session works. This also gets the unix socket code closer to the standard session code handling. --- src/proto_uxst.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 997cf496e..a3bc98dc3 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -641,6 +641,8 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req) memset(&s->data_ctx.stats, 0, sizeof(s->data_ctx.stats)); s->data_source = DATA_SRC_STATS; s->ana_state = STATS_ST_REQ; + buffer_write_dis(s->req); + buffer_shutw_now(s->req); /* fall through */ case STATS_ST_REQ: @@ -655,7 +657,7 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req) *p = '\0'; if (!unix_sock_parse_request(s, line)) { /* invalid request */ - buffer_shutw_now(s->req); + buffer_shutw_now(s->rep); s->ana_state = 0; req->analysers = 0; return 0; @@ -668,19 +670,16 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req) (req->flags & BF_READ_TIMEOUT) || /* read timeout */ tick_is_expired(req->analyse_exp, now_ms) || /* request timeout */ (req->flags & BF_SHUTR)) { /* input closed */ - buffer_shutw_now(s->req); + buffer_shutw_now(s->rep); s->ana_state = 0; req->analysers = 0; return 0; } - /* don't forward nor abort */ - buffer_write_dis(req); return 0; case STATS_ST_REP: /* do nothing while response is being processed */ - buffer_write_dis(s->req); return 0; case STATS_ST_CLOSE: @@ -852,8 +851,6 @@ void uxst_process_session(struct task *t, int *next) /* Analyse response */ - - buffer_write_ena(s->rep); if (unlikely(s->rep->flags & BF_HIJACK)) { /* In inject mode, we wake up everytime something has * happened on the write side of the buffer.