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

Function test_connect

test/connect-rep.c:108–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static int test_connect(struct io_uring *ring,
109 int clientfd, struct sockaddr_in *serv_addr)
110{
111 struct sockaddr_in local_sa;
112 struct io_uring_sqe *sqe;
113 int ret;
114
115 sqe = io_uring_get_sqe(ring);
116 io_uring_prep_connect(sqe, clientfd, (const struct sockaddr *)serv_addr,
117 sizeof(struct sockaddr_in));
118 sqe->user_data = ++ud;
119
120 memcpy(&local_sa, serv_addr, sizeof(local_sa));
121
122 io_uring_submit_and_wait(ring, 1);
123
124 /* check for reuse at the same time */
125 memset(&local_sa, 0xff, sizeof(local_sa));
126
127 ret = get_completion_and_print(ring);
128 if (ret != -ECONNREFUSED) {
129 fprintf(stderr, "Connect got %d\n", ret);
130 return T_EXIT_FAIL;
131 }
132 return T_EXIT_PASS;
133}
134
135static int test(int flags)
136{

Callers 1

testFunction · 0.70

Calls 3

io_uring_submit_and_waitFunction · 0.85
get_completion_and_printFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected