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

Function do_recv

test/socket.c:84–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static int do_recv(struct io_uring *ring, struct iovec *iov)
85{
86 struct io_uring_cqe *cqe;
87 int ret;
88
89 ret = io_uring_wait_cqe(ring, &cqe);
90 if (ret) {
91 fprintf(stdout, "wait_cqe: %d\n", ret);
92 goto err;
93 }
94 if (cqe->res == -EINVAL) {
95 fprintf(stdout, "recv not supported, skipping\n");
96 return 0;
97 }
98 if (cqe->res < 0) {
99 fprintf(stderr, "failed cqe: %d\n", cqe->res);
100 goto err;
101 }
102
103 if (cqe->res -1 != strlen(str)) {
104 fprintf(stderr, "got wrong length: %d/%d\n", cqe->res,
105 (int) strlen(str) + 1);
106 goto err;
107 }
108
109 if (strcmp(str, iov->iov_base)) {
110 fprintf(stderr, "string mismatch\n");
111 goto err;
112 }
113
114 return 0;
115err:
116 return 1;
117}
118
119struct recv_data {
120 pthread_mutex_t mutex;

Callers 1

recv_fnFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected