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

Function replenish_buffers

examples/proxy.c:919–937  ·  view source on GitHub ↗

* Iterate buffers from '*bid' and with a total size of 'bytes' and add them * back to our receive ring so they can be reused for new receives. */

Source from the content-addressed store, hash-verified

917 * back to our receive ring so they can be reused for new receives.
918 */
919static int replenish_buffers(struct conn *c, int *bid, int bytes)
920{
921 struct conn_buf_ring *cbr = &c->in_br;
922 int nr_packets = 0;
923
924 while (bytes) {
925 int this_len = replenish_buffer(cbr, *bid, nr_packets);
926
927 if (this_len > bytes)
928 this_len = bytes;
929 bytes -= this_len;
930
931 *bid = (*bid + 1) & (nr_bufs - 1);
932 nr_packets++;
933 }
934
935 io_uring_buf_ring_advance(cbr->br, nr_packets);
936 return nr_packets;
937}
938
939static void free_mvec(struct msg_vec *mvec)
940{

Callers 1

__handle_recvFunction · 0.85

Calls 1

replenish_bufferFunction · 0.85

Tested by

no test coverage detected