From fe2a0b61bf82cffc3fd1f2886aebcee13b7e5e8a Mon Sep 17 00:00:00 2001 From: Richard Liu Date: Sat, 14 Jul 2018 02:11:28 -0700 Subject: [PATCH] added dial time out --- aws-experiment-launch/experiment/commander/main.go | 2 +- aws-experiment-launch/spot-instance/userdata.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/aws-experiment-launch/experiment/commander/main.go b/aws-experiment-launch/experiment/commander/main.go index f3c98310b..9d24ee3f5 100644 --- a/aws-experiment-launch/experiment/commander/main.go +++ b/aws-experiment-launch/experiment/commander/main.go @@ -119,7 +119,7 @@ func dictateNodes(command string) { func dictateNode(addr string, command string) { // creates client - conn, err := net.Dial("tcp", addr) + conn, err := net.DialTimeout("tcp", addr, 5*time.Second) if err != nil { log.Println(err) return diff --git a/aws-experiment-launch/spot-instance/userdata.sh b/aws-experiment-launch/spot-instance/userdata.sh index 86474906a..56b3cfeab 100644 --- a/aws-experiment-launch/spot-instance/userdata.sh +++ b/aws-experiment-launch/spot-instance/userdata.sh @@ -9,8 +9,7 @@ curl http://$commanderIP:8080/txgen -o txgen chmod +x ./txgen # Get My IP -wget http://169.254.169.254/latest/meta-data/public-ipv4 -ip=$(head -n 1 public-ipv4) +ip=`curl http://169.254.169.254/latest/meta-data/public-ipv4` node_port=9000 soldier_port=1$node_port