From 33f2d8350614490f61248fb0f813dcba5328ce19 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Fri, 4 Jan 2019 10:44:22 -0800 Subject: [PATCH] Add timeout and prints to port search Otherwise nc can hang forever. --- multinode-demo/fullnode.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index cffe10720..b4e38fef1 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -133,11 +133,13 @@ else mkdir -p "$SOLANA_CONFIG_DIR" fullnode_json_path=$SOLANA_CONFIG_DIR/fullnode-x$$.json + echo "Finding a port.." # Find an available port in the range 9100-9899 (( port = 9100 + ($$ % 800) )) while true; do (( port = port >= 9900 ? 9100 : ++port )) - if ! nc -z 127.0.0.1 $port; then + echo "Testing $port" + if ! nc -w 10 -z 127.0.0.1 $port; then echo "Selected port $port" break; fi