MCPcopy Create free account
hub / github.com/axboe/liburing / handle_send_buf

Function handle_send_buf

examples/proxy.c:1594–1622  ·  view source on GitHub ↗

* sendmsg, or send without a ring. Just add buffers back to the ingoing * ring for receives. */

Source from the content-addressed store, hash-verified

1592 * ring for receives.
1593 */
1594static int handle_send_buf(struct conn *c, struct conn_dir *cd, int bid,
1595 int bytes)
1596{
1597 struct conn_buf_ring *in_cbr = &c->in_br;
1598 int i = 0;
1599
1600 while (bytes) {
1601 struct io_uring_buf *buf = &in_cbr->br->bufs[bid];
1602 int this_bytes;
1603
1604 this_bytes = bytes;
1605 if (this_bytes > buf->len)
1606 this_bytes = buf->len;
1607
1608 vlog("%d: send: bid=%d, len=%d\n", c->tid, bid, this_bytes);
1609
1610 cd->out_bytes += this_bytes;
1611 /* each recvmsg mshot package has this overhead */
1612 if (rcv_msg && recv_mshot)
1613 cd->out_bytes += sizeof(struct io_uring_recvmsg_out);
1614 replenish_buffer(in_cbr, bid, i);
1615 bid = (bid + 1) & (nr_bufs - 1);
1616 bytes -= this_bytes;
1617 i++;
1618 }
1619 io_uring_buf_ring_advance(in_cbr->br, i);
1620 cd->snd_next_bid = bid;
1621 return i;
1622}
1623
1624static int __handle_send(struct io_uring *ring, struct conn *c,
1625 struct conn_dir *cd, struct io_uring_cqe *cqe)

Callers 1

__handle_sendFunction · 0.85

Calls 1

replenish_bufferFunction · 0.85

Tested by

no test coverage detected