]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: use the new buffer API
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Jun 2018 05:03:14 +0000 (07:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:42 +0000 (16:23 +0200)
A few locations still accessing ->i and ->o directly were changed to
use ci_data() and co_data() respectively. A call to b_del() was replaced
with co_set_data() in si_cs_send() so that ->o will is automatically be
decremented after the migration.

src/stream_interface.c

index 6542f9f93c5efd49202310249e87d5c03b865148..4b861028860ed826eac4dedf182f1e88c344b4c5 100644 (file)
@@ -508,16 +508,16 @@ void stream_int_notify(struct stream_interface *si)
 
        if (!channel_is_empty(ic) &&
            (si_opposite(si)->flags & SI_FL_WAIT_DATA) &&
-           (ic->buf->i == 0 || ic->pipe)) {
+           (ci_data(ic) == 0 || ic->pipe)) {
                int new_len, last_len;
 
-               last_len = ic->buf->o;
+               last_len = co_data(ic);
                if (ic->pipe)
                        last_len += ic->pipe->data;
 
                si_chk_snd(si_opposite(si));
 
-               new_len = ic->buf->o;
+               new_len = co_data(ic);
                if (ic->pipe)
                        new_len += ic->pipe->data;
 
@@ -653,7 +653,7 @@ static void si_cs_send(struct conn_stream *cs)
        /* At this point, the pipe is empty, but we may still have data pending
         * in the normal buffer.
         */
-       if (!oc->buf->o)
+       if (!co_data(oc))
                return;
 
        /* when we're here, we already know that there is no spliced
@@ -687,7 +687,7 @@ static void si_cs_send(struct conn_stream *cs)
                if (ret > 0) {
                        oc->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA | CF_WRITE_EVENT;
 
-                       b_del(oc->buf, ret);
+                       co_set_data(oc, co_data(oc) - ret);
                        c_realign_if_empty(oc);
 
                        if (!co_data(oc)) {
@@ -1097,7 +1097,7 @@ static void si_cs_recv_cb(struct conn_stream *cs)
 
        cur_read = 0;
 
-       if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !ic->buf->o &&
+       if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !co_data(ic) &&
            global.tune.idle_timer &&
            (unsigned short)(now_ms - ic->last_read) >= global.tune.idle_timer) {
                /* The buffer was empty and nothing was transferred for more