Commit 39348f5f authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Jakub Kicinski
Browse files

selftests: mptcp: wait for port instead of sleep



After having started mptcp_connect in listening mode,
'mptcp_lib_wait_local_port_listen' can be used to wait for the listening
socket to be ready.

This is better than using the 'sleep' command, not to pause for a fixed
amount of time, but waiting for an event. This helper is used in all
other MPTCP selftests, but not in these two.

Reviewed-by: default avatarGeliang Tang <geliang@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20251114-net-next-mptcp-sft-count-cache-stats-timeout-v1-7-863cb04e1b7b@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8c1fe0a5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ do_transfer()
				${local_addr} < "$sin" > "$sout" &
	local spid=$!

	sleep 1
	mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}"

	timeout ${timeout_test} \
		ip netns exec ${connector_ns} \
+2 −1
Original line number Diff line number Diff line
@@ -211,7 +211,8 @@ make_connection()
	ip netns exec "$ns1" \
	   ./mptcp_connect -s MPTCP -w 300 -p $app_port -l $listen_addr > /dev/null 2>&1 &
	local server_pid=$!
	sleep 0.5

	mptcp_lib_wait_local_port_listen "${ns1}" "${port}"

	# Run the client, transfer $file and stay connected to the server
	# to conduct tests