Merge remote-tracking branch 'upstream-public/pr/1330' into mbedtls-1.3
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index b99aeb6..20afbba 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -1620,8 +1620,13 @@
#if !defined(_WIN32)
if( received_sigterm )
{
- polarssl_printf( " interrupted by SIGTERM\n" );
- ret = 0;
+ polarssl_printf( " interrupted by SIGTERM (not in net_accept())\n" );
+ if( ret == POLARSSL_ERR_NET_RECV_FAILED ||
+ ret == POLARSSL_ERR_NET_SEND_FAILED )
+ {
+ ret = 0;
+ }
+
goto exit;
}
#endif
@@ -1653,8 +1658,10 @@
#if !defined(_WIN32)
if( received_sigterm )
{
- polarssl_printf( " interrupted by signal\n" );
- ret = 0;
+ polarssl_printf( " interrupted by SIGTERM (in net_accept())\n" );
+ if( ret == POLARSSL_ERR_NET_ACCEPT_FAILED )
+ ret = 0;
+
goto exit;
}
#endif
diff --git a/tests/compat.sh b/tests/compat.sh
index d22a281..dcbe1bf 100755
--- a/tests/compat.sh
+++ b/tests/compat.sh
@@ -780,8 +780,9 @@
done
}
else
+ echo "Warning: lsof not available, wait_server_start = sleep"
wait_server_start() {
- sleep 1
+ sleep 2
}
fi
diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh
index b82f18e..27f8160 100755
--- a/tests/ssl-opt.sh
+++ b/tests/ssl-opt.sh
@@ -187,6 +187,7 @@
done
}
else
+ echo "Warning: lsof not available, wait_server_start = sleep $START_DELAY"
wait_server_start() {
sleep "$START_DELAY"
}
@@ -409,13 +410,22 @@
# used by watchdog
MAIN_PID="$$"
-# be more patient with valgrind
+# We use somewhat arbitrary delays for tests:
+# - how long do we wait for the server to start (when lsof not available)?
+# - how long do we allow for the client to finish?
+# (not to check performance, just to avoid waiting indefinitely)
+# Things are slower with valgrind, so give extra time here.
+#
+# Note: without lsof, there is a trade-off between the running time of this
+# script and the risk of spurious errors because we didn't wait long enough.
+# The watchdog delay on the other hand doesn't affect normal running time of
+# the script, only the case where a client or server gets stuck.
if [ "$MEMCHECK" -gt 0 ]; then
- START_DELAY=3
- DOG_DELAY=30
+ START_DELAY=6
+ DOG_DELAY=60
else
- START_DELAY=1
- DOG_DELAY=10
+ START_DELAY=2
+ DOG_DELAY=20
fi
# Pick a "unique" port in the range 10000-19999.