size_t (*rcv_buf)(struct connection *conn, void *xprt_ctx, struct buffer *buf, size_t count, int flags); /* recv callback */
size_t (*snd_buf)(struct connection *conn, void *xprt_ctx, const struct buffer *buf, size_t count, int flags); /* send callback */
int (*rcv_pipe)(struct connection *conn, void *xprt_ctx, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
- int (*snd_pipe)(struct connection *conn, void *xprt_ctx, struct pipe *pipe); /* send-to-pipe callback */
+ int (*snd_pipe)(struct connection *conn, void *xprt_ctx, struct pipe *pipe, unsigned int count); /* send-to-pipe callback */
void (*shutr)(struct connection *conn, void *xprt_ctx, int); /* shutr function */
void (*shutw)(struct connection *conn, void *xprt_ctx, int); /* shutw function */
void (*close)(struct connection *conn, void *xprt_ctx); /* close the transport layer */
/* Send as many bytes as possible from the pipe to the connection's socket.
*/
-int raw_sock_from_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe)
+int raw_sock_from_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe, unsigned int count)
{
int ret, done;
return 0;
}
+ if (unlikely(count > pipe->data))
+ count = pipe->data;
+
done = 0;
- while (pipe->data) {
- ret = splice(pipe->cons, NULL, conn->handle.fd, NULL, pipe->data,
+ while (count) {
+ ret = splice(pipe->cons, NULL, conn->handle.fd, NULL, count,
SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
if (ret <= 0) {
}
done += ret;
+ count -= ret;
pipe->data -= ret;
}
if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && done) {