From d437b68a889337abdb82ba43713b9d97e67f5aea Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Tue, 8 Mar 2022 12:59:18 -0800
Subject: [PATCH] WIP: Improve documentation

---
 README.md           |  9 +++++----
 localNetwork/run.sh | 14 ++++++++++----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 861c89f..8f23c38 100644
--- a/README.md
+++ b/README.md
@@ -27,10 +27,11 @@ is added to this testing suite via the run script (`run.sh`)
 ## Local Network
 
 The [localNetwork package](./localNetwork) is a more general use network tool.
-This package will run a local version of the xx network on a single machine. 
-This can be done either via the `run.sh` script, which will run the network entirely
-locally with internal IP addresses, or the `runpublish.sh`, which runs the network
-with remotely accessible IP addresses.
+This package will run a local version of the xx network on a single machine until a 
+manually killed by the user. This can be done either via the `run.sh` script,
+which will run the network with internal IP addresses, or the `runpublish.sh`, which runs the network
+with remotely accessible IP addresses. With this network established, a developer may,
+for example, test the xxDK against it. 
 
 ## How to manually run locally
 
diff --git a/localNetwork/run.sh b/localNetwork/run.sh
index b33736e..8dfecf1 100755
--- a/localNetwork/run.sh
+++ b/localNetwork/run.sh
@@ -1,4 +1,7 @@
 #!/usr/bin/env bash
+
+set -e
+
 # Clear out the previous run's logs
 rm gateway*-knownRound || true
 rm errServer-* || true
@@ -18,9 +21,9 @@ UDBOUT=results/udb-console.txt
 mkdir -p $SERVERLOGS
 mkdir -p $GATEWAYLOGS
 
-# Allow for verbose gRPC logs
-export GRPC_GO_LOG_VERBOSITY_LEVEL=99
-export GRPC_GO_LOG_SEVERITY_LEVEL=info
+## Uncomment to allow for verbose gRPC logs
+#export GRPC_GO_LOG_VERBOSITY_LEVEL=99
+#export GRPC_GO_LOG_SEVERITY_LEVEL=info
 
 
 nodes=$(ls -1q ./server-*.yaml | wc -l | xargs)
@@ -86,6 +89,7 @@ finish() {
         echo "KILL -9 $job"
         kill -9 $job || true
     done
+    set +x
 }
 
 echo "You can't use the network until rounds run."
@@ -94,9 +98,11 @@ echo "and review logs for what went wrong."
 rm rid.txt || true
 touch rid.txt
 echo -n "Waiting for rounds to run..."
-while [ ! -s rid.txt ]; do
+cnt=0
+while [ ! -s rid.txt ] && [ $cnt -lt 240 ]; do
     sleep 1
     grep -a "RID 1 ReceiveFinishRealtime END" results/servers/server-2.log > rid.txt || true
+    cnt=$(($cnt + 1))
     echo -n "."
 done
 
-- 
GitLab