mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 23:44:41 +00:00
MINOR: channel: don't use co_set_data() to decrement output
The use of co_set_data() should be strictly limited to setting the amount of existing data to be transmitted. It ought not be used to decrement the output after the data have left the buffer, because doing so involves performing incorrect calculations using co_data() that still comprises data that are not in the buffer anymore. Let's use c_rew() for this, which is made exactly for this purpose, i.e. decrement c->output by as much as requested. This is cleaner, faster, and will permit stricter checks.
This commit is contained in:
parent
8873b85bd9
commit
84240044f0
@ -1007,7 +1007,7 @@ static inline int32_t co_htx_remove_blk(struct channel *chn, struct htx *htx, st
|
||||
int32_t size = htx_get_blksz(blk);
|
||||
|
||||
htx_remove_blk(htx, blk);
|
||||
co_set_data(chn, co_data(chn) - size);
|
||||
c_rew(chn, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -4991,7 +4991,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K
|
||||
break;
|
||||
}
|
||||
|
||||
co_set_data(req, co_data(req) - vlen);
|
||||
c_rew(req, vlen);
|
||||
count -= vlen;
|
||||
if (sz == vlen)
|
||||
blk = htx_remove_blk(htx, blk);
|
||||
@ -5081,7 +5081,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon
|
||||
break;
|
||||
}
|
||||
|
||||
co_set_data(req, co_data(req) - vlen);
|
||||
c_rew(req, vlen);
|
||||
count -= vlen;
|
||||
if (len > 0)
|
||||
len -= vlen;
|
||||
|
@ -792,7 +792,7 @@ int si_cs_send(struct conn_stream *cs)
|
||||
ret = conn->mux->snd_buf(cs, &oc->buf, co_data(oc), send_flag);
|
||||
if (ret > 0) {
|
||||
did_send = 1;
|
||||
co_set_data(oc, co_data(oc) - ret);
|
||||
c_rew(oc, ret);
|
||||
c_realign_if_empty(oc);
|
||||
|
||||
if (!co_data(oc)) {
|
||||
|
Loading…
Reference in New Issue
Block a user