]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] fix unix socket processing of interrupted output
authorWilly Tarreau <w@1wt.eu>
Sun, 22 Feb 2009 14:58:45 +0000 (15:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 22 Feb 2009 14:58:45 +0000 (15:58 +0100)
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

index 997cf496eb5055908c411f04529833cf27a79bde..a3bc98dc3683ff2aa74c827f4465a0b5c86bbb40 100644 (file)
@@ -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.