mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-03 15:31:06 +00:00
compat.sh: use wait_server_start
Port wait_server_start from ssl-opt.sh to compat.sh, instead of just using "sleep 1". This solves the problem that on a heavily loaded machine, sleep 1 is sometimes not enough (we had CI failures because of this). This is also faster on a lightly-loaded machine.
This commit is contained in:
parent
80f6be76e0
commit
103299edb7
|
@ -764,6 +764,28 @@ has_mem_err() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Wait for process $2 to be listening on port $1
|
||||
if type lsof >/dev/null 2>/dev/null; then
|
||||
wait_server_start() {
|
||||
START_TIME=$(date +%s)
|
||||
while ! lsof -a -n -b -i "TCP:$1" -p "$2" >/dev/null 2>/dev/null; do
|
||||
if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then
|
||||
echo "SERVERSTART TIMEOUT"
|
||||
echo "SERVERSTART TIMEOUT" >> $SRV_OUT
|
||||
break
|
||||
fi
|
||||
# Linux and *BSD support decimal arguments to sleep. On other
|
||||
# OSes this may be a tight loop.
|
||||
sleep 0.1 2>/dev/null || true
|
||||
done
|
||||
}
|
||||
else
|
||||
wait_server_start() {
|
||||
sleep 1
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
# start_server <name>
|
||||
# also saves name and command
|
||||
start_server() {
|
||||
|
@ -792,7 +814,7 @@ start_server() {
|
|||
$SERVER_CMD >> $SRV_OUT 2>&1 &
|
||||
PROCESS_ID=$!
|
||||
|
||||
sleep 1
|
||||
wait_server_start "$PORT" "$PROCESS_ID"
|
||||
}
|
||||
|
||||
# terminate the running server
|
||||
|
|
Loading…
Reference in a new issue