]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: adapt to the new buffers API
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Jun 2018 17:41:31 +0000 (19:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:42 +0000 (16:23 +0200)
The changes are fairly straightforward. Some places require to trim
the length. Maybe we'd need a b_extend() or b_adjust() for this.

src/stats.c

index aa4aaaaaa9d991b6df621439c33e11ce4ad47626..c0c1b35a7619db3b8b564541c380d850f4b6b167 100644 (file)
@@ -3054,7 +3054,7 @@ static void http_stats_io_handler(struct appctx *appctx)
        }
 
        if (appctx->st0 == STAT_HTTP_DUMP) {
-               unsigned int prev_len = si_ib(si)->i;
+               unsigned int prev_len = ci_data(si_ic(si));
                unsigned int data_len;
                unsigned int last_len;
                unsigned int last_fwd = 0;
@@ -3075,11 +3075,11 @@ static void http_stats_io_handler(struct appctx *appctx)
                        }
                }
 
-               data_len = si_ib(si)->i;
+               data_len = ci_data(si_ic(si));
                if (stats_dump_stat_to_buffer(si, s->be->uri_auth))
                        appctx->st0 = STAT_HTTP_DONE;
 
-               last_len = si_ib(si)->i;
+               last_len = ci_data(si_ic(si));
 
                /* Now we must either adjust or remove the chunk size. This is
                 * not easy because the chunk size might wrap at the end of the
@@ -3090,7 +3090,7 @@ static void http_stats_io_handler(struct appctx *appctx)
                 */
                if (appctx->ctx.stats.flags & STAT_CHUNKED) {
                        si_ic(si)->total -= (last_len - prev_len);
-                       si_ib(si)->i     -= (last_len - prev_len);
+                       b_sub(si_ib(si), (last_len - prev_len));
 
                        if (last_len != data_len) {
                                chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len));
@@ -3098,7 +3098,7 @@ static void http_stats_io_handler(struct appctx *appctx)
                                        si_applet_cant_put(si);
 
                                si_ic(si)->total += (last_len - data_len);
-                               si_ib(si)->i     += (last_len - data_len);
+                               b_add(si_ib(si), last_len - data_len);
                        }
                        /* now re-enable forwarding */
                        channel_forward(si_ic(si), last_fwd);
@@ -3126,7 +3126,7 @@ static void http_stats_io_handler(struct appctx *appctx)
                        }
                }
                /* eat the whole request */
-               co_skip(si_oc(si), si_ob(si)->o);
+               co_skip(si_oc(si), co_data(si_oc(si)));
                res->flags |= CF_READ_NULL;
                si_shutr(si);
        }