Add a thread to support thin clients

This commit is contained in:
Greg Fitzgerald
2018-05-07 21:44:44 -06:00
parent a59f64cae1
commit 9ff1a6f0cd
3 changed files with 49 additions and 12 deletions

View File

@@ -55,6 +55,7 @@ fn main() {
let serve_addr = format!("0.0.0.0:{}", port);
let gossip_addr = format!("0.0.0.0:{}", port + 1);
let replicate_addr = format!("0.0.0.0:{}", port + 2);
let skinny_addr = format!("0.0.0.0:{}", port + 3);
if stdin_isatty() {
eprintln!("nothing found on stdin, expected a log file");
@@ -122,6 +123,7 @@ fn main() {
let serve_sock = UdpSocket::bind(&serve_addr).unwrap();
let gossip_sock = UdpSocket::bind(&gossip_addr).unwrap();
let replicate_sock = UdpSocket::bind(&replicate_addr).unwrap();
let skinny_sock = UdpSocket::bind(&skinny_addr).unwrap();
let pubkey = KeyPair::new().pubkey();
let d = ReplicatedData::new(
pubkey,
@@ -130,8 +132,15 @@ fn main() {
serve_sock.local_addr().unwrap(),
);
eprintln!("starting server...");
let threads =
AccountantSkel::serve(&skel, d, serve_sock, gossip_sock, exit.clone(), stdout()).unwrap();
let threads = AccountantSkel::serve(
&skel,
d,
serve_sock,
skinny_sock,
gossip_sock,
exit.clone(),
stdout(),
).unwrap();
eprintln!("Ready. Listening on {}", serve_addr);
for t in threads {
t.join().expect("join");