Use streaming socket interface within accountant
Pull messages from streamer process them and forward them to the sender.
This commit is contained in:
@@ -4,6 +4,7 @@ extern crate silk;
|
||||
use silk::accountant_skel::AccountantSkel;
|
||||
use silk::accountant::Accountant;
|
||||
use std::io::{self, BufRead};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
fn main() {
|
||||
let addr = "127.0.0.1:8000";
|
||||
@@ -13,7 +14,8 @@ fn main() {
|
||||
.lines()
|
||||
.map(|line| serde_json::from_str(&line.unwrap()).unwrap());
|
||||
let acc = Accountant::new_from_entries(entries, Some(1000));
|
||||
let mut skel = AccountantSkel::new(acc);
|
||||
let exit = Arc::new(Mutex::new(false));
|
||||
let skel = Arc::new(Mutex::new(AccountantSkel::new(acc)));
|
||||
eprintln!("Listening on {}", addr);
|
||||
skel.serve(addr).unwrap();
|
||||
let _threads = AccountantSkel::serve(skel, addr, exit.clone()).unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user