Lines Matching +full:total +full:- +full:timeout
1 // SPDX-License-Identifier: GPL-2.0
51 fprintf(stderr, "Usage: mptcp_inq [-6] [ -t tcp|mptcp ] [ -r tcp|mptcp]\n"); in die_usage()
92 int sock = -1; in sock_listen_mptcp()
107 for (a = addr; a; a = a->ai_next) { in sock_listen_mptcp()
108 sock = socket(a->ai_family, a->ai_socktype, proto_rx); in sock_listen_mptcp()
112 if (-1 == setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, in sock_listen_mptcp()
116 if (bind(sock, a->ai_addr, a->ai_addrlen) == 0) in sock_listen_mptcp()
121 sock = -1; in sock_listen_mptcp()
143 int sock = -1; in sock_connect_mptcp()
148 for (a = addr; a; a = a->ai_next) { in sock_connect_mptcp()
149 sock = socket(a->ai_family, a->ai_socktype, proto); in sock_connect_mptcp()
153 if (connect(sock, a->ai_addr, a->ai_addrlen) == 0) in sock_connect_mptcp()
181 while ((c = getopt(argc, argv, "h6t:r:")) != -1) { in parse_opts()
202 /* wait up to timeout milliseconds */
203 static void wait_for_ack(int fd, int timeout, size_t total) in wait_for_ack() argument
207 for (i = 0; i < timeout; i++) { in wait_for_ack()
208 int nsd, ret, queued = -1; in wait_for_ack()
219 if ((size_t)queued > total) in wait_for_ack()
220 xerror("TIOCOUTQ %u, but only %zu expected\n", queued, total); in wait_for_ack()
232 xerror("still tx data queued after %u ms\n", timeout); in wait_for_ack()
237 size_t len, i, total, sent; in connect_one_server() local
241 len = rand() % (sizeof(buf) - 1); in connect_one_server()
253 /* un-block server */ in connect_one_server()
272 total = rand() % (16 * 1024 * 1024); in connect_one_server()
273 total += (1 * 1024 * 1024); in connect_one_server()
274 sent = total; in connect_one_server()
276 ret = write(unixfd, &total, sizeof(total)); in connect_one_server()
277 assert(ret == (ssize_t)sizeof(total)); in connect_one_server()
281 while (total > 0) { in connect_one_server()
282 if (total > sizeof(buf)) in connect_one_server()
285 len = total; in connect_one_server()
290 total -= ret; in connect_one_server()
293 * number of total bytes sent in connect_one_server()
317 if (cmsg->cmsg_level == IPPROTO_TCP && cmsg->cmsg_type == TCP_CM_INQ) { in get_tcp_inq()
372 /* read one byte, expect cmsg to return expected - 1 */ in process_one_client()
382 assert((size_t)tcp_inq == (expect_len - 1)); in process_one_client()
418 if (tcp_inq > expect_len - tot) in process_one_client()
420 tcp_inq, expect_len - tot, (int)expect_len); in process_one_client()
422 assert(tcp_inq <= expect_len - tot); in process_one_client()
471 int fd = -1, r, on = 1; in server()
491 if (-1 == setsockopt(r, IPPROTO_TCP, TCP_INQ, &on, sizeof(on))) in server()
501 int fd = -1; in client()
525 if (getrandom(&foo, sizeof(foo), 0) == -1) { in init_rng()
590 if (ret == -1) in main()
594 if (ret == -1) in main()