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

Function submit_send

examples/proxy.c:1398–1443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398static void submit_send(struct io_uring *ring, struct conn *c,
1399 struct conn_dir *cd, int fd, void *data, int len,
1400 int bid, int flags)
1401{
1402 struct io_uring_sqe *sqe;
1403 int bgid = c->out_br.bgid;
1404
1405 if (cd->pending_send)
1406 return;
1407 cd->pending_send = 1;
1408
1409 flags |= MSG_WAITALL | MSG_NOSIGNAL;
1410
1411 sqe = get_sqe(ring);
1412 if (snd_msg) {
1413 struct io_msg *imsg = &cd->io_snd_msg;
1414
1415 if (snd_zc) {
1416 io_uring_prep_sendmsg_zc(sqe, fd, &imsg->msg, flags);
1417 cd->snd_notif++;
1418 } else {
1419 io_uring_prep_sendmsg(sqe, fd, &imsg->msg, flags);
1420 }
1421 } else if (send_ring) {
1422 io_uring_prep_send(sqe, fd, NULL, 0, flags);
1423 } else if (!snd_zc) {
1424 io_uring_prep_send(sqe, fd, data, len, flags);
1425 } else {
1426 io_uring_prep_send_zc(sqe, fd, data, len, flags, 0);
1427 sqe->ioprio |= IORING_RECVSEND_FIXED_BUF;
1428 sqe->buf_index = bid;
1429 cd->snd_notif++;
1430 }
1431 encode_userdata(sqe, c, __SEND, bid, fd);
1432 if (fixed_files)
1433 sqe->flags |= IOSQE_FIXED_FILE;
1434 if (send_ring) {
1435 sqe->flags |= IOSQE_BUFFER_SELECT;
1436 sqe->buf_group = bgid;
1437 }
1438 if (snd_bundle) {
1439 sqe->ioprio |= IORING_RECVSEND_BUNDLE;
1440 cd->snd_mshot++;
1441 } else if (send_ring)
1442 cd->snd_mshot++;
1443}
1444
1445/*
1446 * Prepare the next send request, if we need to. If one is already pending,

Callers 1

prep_next_sendFunction · 0.85

Calls 2

get_sqeFunction · 0.70
encode_userdataFunction · 0.70

Tested by

no test coverage detected