fixed client demo (#325)

* fixed client demo
This commit is contained in:
anatoly yakovenko 2018-06-07 13:51:15 -07:00 committed by GitHub
parent c78132417f
commit 77c9e801aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 18 deletions

View File

@ -132,7 +132,7 @@ Now that your singlenode or multinode testnet is up and running, in a separate s
the JSON configuration file here, not the genesis ledger.
```bash
$ ./multinode-demo/client.sh ubuntu@10.0.1.51:~/solana #The leader machine
$ ./multinode-demo/client.sh ubuntu@10.0.1.51:~/solana 2 #The leader machine and the total number of nodes in the network
```
What just happened? The client demo spins up several threads to send 500,000 transactions

View File

@ -1,11 +1,15 @@
#!/bin/bash -e
if [[ -z "$1" ]]; then
echo "usage: $0 [network path to solana repo on leader machine]"
echo "usage: $0 [network path to solana repo on leader machine] [number of nodes in the network if greater then 1]"
exit 1
fi
LEADER="$1"
COUNT="$2"
if [[ -z "$2" ]]; then
COUNT=1
fi
set -x
export RUST_LOG=solana=info
@ -13,4 +17,4 @@ rsync -v -e ssh "$LEADER/leader.json" .
rsync -v -e ssh "$LEADER/mint-demo.json" .
cargo run --release --bin solana-client-demo -- \
-l leader.json < mint-demo.json 2>&1 | tee client.log
-l leader.json -n $COUNT -d < mint-demo.json 2>&1 | tee client.log

View File

@ -109,9 +109,10 @@ fn main() {
&client_addr,
&leader,
signal.clone(),
num_nodes + 2,
num_nodes,
&mut c_threads,
);
assert_eq!(validators.len(), num_nodes);
if stdin_isatty() {
eprintln!("nothing found on stdin, expected a json file");
@ -296,26 +297,27 @@ fn converge(
gossip_send_socket,
exit.clone(),
).expect("DataReplicator::new");
//wait for the network to converge
let mut rv = vec![];
//wait for the network to converge, 30 seconds should be plenty
for _ in 0..30 {
let min = spy_ref.read().unwrap().convergence();
if num_nodes as u64 == min {
println!("converged!");
let v: Vec<ReplicatedData> = spy_ref
.read()
.unwrap()
.table
.values()
.into_iter()
.filter(|x| x.requests_addr != daddr)
.cloned()
.collect();
if v.len() >= num_nodes {
println!("CONVERGED!");
rv.extend(v.into_iter());
break;
}
sleep(Duration::new(1, 0));
}
threads.extend(data_replicator.thread_hdls.into_iter());
let v: Vec<ReplicatedData> = spy_ref
.read()
.unwrap()
.table
.values()
.into_iter()
.filter(|x| x.requests_addr != daddr)
.map(|x| x.clone())
.collect();
v.clone()
rv
}
fn read_leader(path: String) -> ReplicatedData {