diff options
-rw-r--r-- | lib/chutney/TorNet.py | 3 | ||||
-rwxr-xr-x | tools/bootstrap-network.sh | 45 | ||||
-rw-r--r-- | torrc_templates/authority.tmpl | 4 | ||||
-rw-r--r-- | torrc_templates/client.tmpl | 4 | ||||
-rw-r--r-- | torrc_templates/relay.tmpl | 4 |
5 files changed, 60 insertions, 0 deletions
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py index 4ebcc2d..4f31e8c 100644 --- a/lib/chutney/TorNet.py +++ b/lib/chutney/TorNet.py @@ -591,6 +591,9 @@ class Network(object): statuses = [ n.getController().check() for n in self._nodes] n_ok = len([x for x in statuses if x]) print "%d/%d nodes are running"%(n_ok,len(self._nodes)) + if n_ok != len(self._nodes): + return False + return True def restart(self): self.stop() diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh new file mode 100755 index 0000000..17c9792 --- /dev/null +++ b/tools/bootstrap-network.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# +# 1. potentially stop running network +# 2. bootstrap a network from scratch as quickly as possible +# 3. tail -F all the tor log files +# +# NOTE: leaves debris around by renaming directory net/nodes +# and creating a new net/nodes +# +# Usage: +# cd YOUR-CHUTNEY-DIRECTORY +# tools/bootstrap-network.sh [network-flavour] +# network-flavour: one of the files in the networks directory, +# (default: 'basic') +# + +VOTING_OFFSET=6 +CHUTNEY=./chutney +myname=$(basename "$0") + +[ -x $CHUTNEY ] || { echo "$myname: missing $CHUTNEY"; exit 1; } +[ -d networks ] || { echo "$myname: missing directory: networks"; exit 1; } +flavour=basic; [ -n "$1" ] && { flavour=$1; shift; } + +$CHUTNEY stop networks/$flavour +[ -d net/nodes ] && { + DEST=net/nodes.$(date +%s) + echo "$myname: NOTE: renaming net/nodes to $DEST" + mv net/nodes $DEST +} +echo "$myname: boostrapping network: $flavour" +$CHUTNEY configure networks/$flavour + +# TODO: Make 'chutney configure' take an optional offset argument and +# use the templating system in Chutney to set this instead of editing +# files like this. +offset=$(expr \( $(date +%s) + $VOTING_OFFSET \) % 300) +CONFOPT="TestingV3AuthVotingStartOffset" +for file in net/nodes/*a/torrc; do + sed -i.bak -e "s/^${CONFOPT}.*$/${CONFOPT} $offset/1" $file +done + +$CHUTNEY start networks/$flavour +$CHUTNEY status networks/$flavour +#echo "tail -F net/nodes/*/notice.log" diff --git a/torrc_templates/authority.tmpl b/torrc_templates/authority.tmpl index 6e18d86..7bf99af 100644 --- a/torrc_templates/authority.tmpl +++ b/torrc_templates/authority.tmpl @@ -3,3 +3,7 @@ AuthoritativeDirectory 1 V3AuthoritativeDirectory 1 ContactInfo auth${nodenum}@test.test ExitPolicy reject *:* +TestingV3AuthInitialVotingInterval 300 +TestingV3AuthInitialVoteDelay 2 +TestingV3AuthInitialDistDelay 2 +TestingV3AuthVotingStartOffset 0 diff --git a/torrc_templates/client.tmpl b/torrc_templates/client.tmpl index aa86c01..1eb1d99 100644 --- a/torrc_templates/client.tmpl +++ b/torrc_templates/client.tmpl @@ -1,2 +1,6 @@ ${include:common.i} SocksPort $socksport +#NOTE: Setting TestingClientConsensusDownloadSchedule doesn't +# help -- dl_stats.schedule is not DL_SCHED_CONSENSUS +# at boostrap time. +TestingClientDownloadSchedule 10, 2, 2, 4, 4, 8, 13, 18, 25, 40, 60 diff --git a/torrc_templates/relay.tmpl b/torrc_templates/relay.tmpl index 09dd1f0..2f4b7f1 100644 --- a/torrc_templates/relay.tmpl +++ b/torrc_templates/relay.tmpl @@ -3,3 +3,7 @@ SocksPort 0 OrPort $orport Address $ip DirPort $dirport +#NOTE: Setting TestingServerConsensusDownloadSchedule doesn't +# help -- dl_stats.schedule is not DL_SCHED_CONSENSUS +# at boostrap time. +TestingServerDownloadSchedule 10, 2, 2, 4, 4, 8, 13, 18, 25, 40, 60 |