int (*wake)(struct connection *conn); /* mux-layer callback to report activity, mandatory */
void (*update_poll)(struct conn_stream *cs); /* commit cs flags to mux/conn */
int (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, int count); /* Called from the upper layer to get data */
- int (*snd_buf)(struct conn_stream *cs, struct buffer *buf, int flags); /* Called from the upper layer to send data */
+ size_t (*snd_buf)(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
int (*rcv_pipe)(struct conn_stream *cs, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
int (*snd_pipe)(struct conn_stream *cs, struct pipe *pipe); /* send-to-pipe callback */
void (*shutr)(struct conn_stream *cs, enum cs_shr_mode); /* shutr function */
goto out_unlock;
if (check->bo->o) {
- conn->mux->snd_buf(cs, check->bo, 0);
+ b_del(check->bo, conn->mux->snd_buf(cs, check->bo, check->bo->o, 0));
+ b_realign_if_empty(check->bo);
+
if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) {
chk_report_conn_err(check, errno, 0);
__cs_stop_both(cs);
(&check->current_step->list == head ||
check->current_step->action != TCPCHK_ACT_SEND ||
check->current_step->string_len >= buffer_total_space(check->bo))) {
+ int ret;
__cs_want_send(cs);
- if (conn->mux->snd_buf(cs, check->bo, 0) <= 0) {
+ ret = conn->mux->snd_buf(cs, check->bo, check->bo->o, 0);
+ b_del(check->bo, ret);
+ b_realign_if_empty(check->bo);
+
+ if (ret <= 0) {
if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) {
chk_report_conn_err(check, errno, 0);
__cs_stop_both(cs);
}
/* Called from the upper layer, to send data */
-static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
+static size_t h2_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
{
struct h2s *h2s = cs->ctx;
- size_t count = buf->o;
size_t total = 0;
size_t ret;
LIST_ADDQ(&h2s->h2c->send_list, &h2s->list);
}
- b_del(buf, total);
return total;
}
}
/* Called from the upper layer, to send data */
-static int mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
+static size_t mux_pt_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
{
- int ret = cs->conn->xprt->snd_buf(cs->conn, buf, buf->o, flags);
-
- if (ret > 0)
- b_del(buf, ret);
-
- b_realign_if_empty(buf);
- return ret;
+ return cs->conn->xprt->snd_buf(cs->conn, buf, count, flags);
}
#if defined(CONFIG_HAP_LINUX_SPLICE)
if (oc->flags & CF_STREAMER)
send_flag |= CO_SFL_STREAMER;
- ret = conn->mux->snd_buf(cs, oc->buf, send_flag);
+ ret = conn->mux->snd_buf(cs, oc->buf, co_data(oc), send_flag);
if (ret > 0) {
oc->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA | CF_WRITE_EVENT;
- if (!oc->buf->o) {
+ b_del(oc->buf, ret);
+ c_realign_if_empty(oc);
+
+ if (!co_data(oc)) {
/* Always clear both flags once everything has been sent, they're one-shot */
oc->flags &= ~(CF_EXPECT_MORE | CF_SEND_DONTWAIT);
}