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

Function __do_send

test/recvsend_bundle.c:388–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388static int __do_send(struct recv_data *rd, struct io_uring *ring, int sockfd)
389{
390 struct io_uring_cqe *cqe;
391 struct io_uring_sqe *sqe;
392 int bytes_needed = MSG_SIZE * nr_msgs;
393 int i, ret;
394
395 for (i = 0; i < nr_msgs; i++) {
396 sqe = io_uring_get_sqe(ring);
397 io_uring_prep_send(sqe, sockfd, NULL, 0, 0);
398 sqe->user_data = 10 + i;
399 sqe->flags |= IOSQE_BUFFER_SELECT;
400 sqe->buf_group = SEND_BGID;
401
402 ret = io_uring_submit(ring);
403 if (ret != 1)
404 return 1;
405
406 if (!i)
407 pthread_barrier_wait(&rd->barrier);
408 ret = io_uring_wait_cqe(ring, &cqe);
409 if (ret) {
410 fprintf(stderr, "send wait cqe %d\n", ret);
411 return 1;
412 }
413
414 if (!i && cqe->res == -EINVAL) {
415 rd->abort = 1;
416 no_send_mshot = 1;
417 break;
418 }
419 if (cqe->res != MSG_SIZE) {
420 fprintf(stderr, "send failed cqe: %d\n", cqe->res);
421 return 1;
422 }
423 if (cqe->res < 0) {
424 fprintf(stderr, "bad send cqe res: %d\n", cqe->res);
425 return 1;
426 }
427 bytes_needed -= cqe->res;
428 io_uring_cqe_seen(ring, cqe);
429 if (!bytes_needed)
430 break;
431 }
432
433 return 0;
434}
435
436static int do_send(struct recv_data *rd)
437{

Callers 1

do_sendFunction · 0.70

Calls 2

io_uring_submitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected