1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Index: carbon-c-relay/test/run-test.sh
===================================================================
--- carbon-c-relay.orig/test/run-test.sh
+++ carbon-c-relay/test/run-test.sh
@@ -128,14 +128,21 @@ run_servertest() {
[[ -e ${confarg2} ]] && mode=DUAL
local start_server_result
- local start_server_lastport=3020 # TODO
+ local start_server_lastport=$((RANDOM % 1024 + 3200)) # TODO
start_server() {
local id=$1
local remoteport=$2
local confarg=$3
local transport="$4"
+ local port
# determine a free port to use
- local port=${start_server_lastport} # TODO
+ for i in $(seq ${start_server_lastport} 60000); do
+ local usagecount=$(ss -Htl "( dport = :${i} or sport = :${i} )" | wc -l)
+ if [ ${usagecount} -eq 0 ]; then
+ port=${i}
+ break
+ fi
+ done
: $((start_server_lastport++)) # TODO
local unixsock="${tmpdir}/sock.${port}"
local cert="${test}.cert"
|