Lines Matching +full:total +full:- +full:timeout

1 // SPDX-License-Identifier: GPL-2.0
50 fprintf(stderr, "Usage: mptcp_inq [-6] [ -t tcp|mptcp ] [ -r tcp|mptcp]\n"); in die_usage()
91 int sock = -1; in sock_listen_mptcp()
106 for (a = addr; a; a = a->ai_next) { in sock_listen_mptcp()
107 sock = socket(a->ai_family, a->ai_socktype, proto_rx); in sock_listen_mptcp()
111 if (-1 == setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, in sock_listen_mptcp()
115 if (bind(sock, a->ai_addr, a->ai_addrlen) == 0) in sock_listen_mptcp()
120 sock = -1; in sock_listen_mptcp()
142 int sock = -1; in sock_connect_mptcp()
147 for (a = addr; a; a = a->ai_next) { in sock_connect_mptcp()
148 sock = socket(a->ai_family, a->ai_socktype, proto); in sock_connect_mptcp()
152 if (connect(sock, a->ai_addr, a->ai_addrlen) == 0) in sock_connect_mptcp()
180 while ((c = getopt(argc, argv, "h6t:r:")) != -1) { in parse_opts()
201 /* wait up to timeout milliseconds */
202 static void wait_for_ack(int fd, int timeout, size_t total) in wait_for_ack() argument
206 for (i = 0; i < timeout; i++) { in wait_for_ack()
207 int nsd, ret, queued = -1; in wait_for_ack()
218 if ((size_t)queued > total) in wait_for_ack()
219 xerror("TIOCOUTQ %u, but only %zu expected\n", queued, total); in wait_for_ack()
231 xerror("still tx data queued after %u ms\n", timeout); in wait_for_ack()
236 size_t len, i, total, sent; in connect_one_server() local
240 len = rand() % (sizeof(buf) - 1); in connect_one_server()
252 /* un-block server */ in connect_one_server()
271 total = rand() % (16 * 1024 * 1024); in connect_one_server()
272 total += (1 * 1024 * 1024); in connect_one_server()
273 sent = total; in connect_one_server()
275 ret = write(unixfd, &total, sizeof(total)); in connect_one_server()
276 assert(ret == (ssize_t)sizeof(total)); in connect_one_server()
280 while (total > 0) { in connect_one_server()
281 if (total > sizeof(buf)) in connect_one_server()
284 len = total; in connect_one_server()
289 total -= ret; in connect_one_server()
292 * number of total bytes sent in connect_one_server()
316 if (cmsg->cmsg_level == IPPROTO_TCP && cmsg->cmsg_type == TCP_CM_INQ) { in get_tcp_inq()
371 /* read one byte, expect cmsg to return expected - 1 */ in process_one_client()
381 assert((size_t)tcp_inq == (expect_len - 1)); in process_one_client()
417 if (tcp_inq > expect_len - tot) in process_one_client()
419 tcp_inq, expect_len - tot, (int)expect_len); in process_one_client()
421 assert(tcp_inq <= expect_len - tot); in process_one_client()
470 int fd = -1, r, on = 1; in server()
490 if (-1 == setsockopt(r, IPPROTO_TCP, TCP_INQ, &on, sizeof(on))) in server()
500 int fd = -1; in client()
593 if (ret == -1) in main()
597 if (ret == -1) in main()