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