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: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu 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: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Matthieu Baerts (NGI0)
2025-11-14 19:12:11 +01:00
committed by Jakub Kicinski
parent 8c1fe0a500
commit 39348f5f2f
2 changed files with 3 additions and 2 deletions

View File

@@ -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} \

View File

@@ -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