Skip to content

Commit

Permalink
multi host client demo
Browse files Browse the repository at this point in the history
  • Loading branch information
aeyakovenko committed May 3, 2018
1 parent 62a6051 commit 658e31c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/accountant_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl AccountantStub {
pub fn get_last_id(&mut self) -> FutureResult<Hash, ()> {
let req = Request::GetLastId;
let data = serialize(&req).expect("serialize GetId");
assert!(data.len() < 4096);
self.socket
.send_to(&data, &self.addr)
.expect("buffer error");
Expand Down
5 changes: 3 additions & 2 deletions src/bin/client-demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use solana::signature::{KeyPair, KeyPairUtil};
use solana::transaction::Transaction;
use std::env;
use std::io::{stdin, Read};
use std::net::UdpSocket;
use std::net::{UdpSocket, SocketAddr};
use std::process::exit;
use std::time::Instant;
use untrusted::Input;
Expand Down Expand Up @@ -120,7 +120,8 @@ fn main() {
let chunks: Vec<_> = transactions.chunks(sz).collect();
chunks.into_par_iter().for_each(|trs| {
println!("Transferring 1 unit {} times...", trs.len());
let send_addr = "0.0.0.0:0";
let mut send_addr:SocketAddr = send_addr.parse().unwrap();
send_addr.set_port(0);
let socket = UdpSocket::bind(send_addr).unwrap();
let acc = AccountantStub::new(&addr, socket);
for tr in trs {
Expand Down

0 comments on commit 658e31c

Please sign in to comment.