1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-24 23:08:39 +01:00

Shorten RPC sender/receiver to tx/rx

This commit is contained in:
Roman Zeyde 2018-06-13 09:18:52 +03:00
parent c3a74e9301
commit 4b0773e55b
No known key found for this signature in database
GPG key ID: 87CAE5FA46917CBB

View file

@ -387,12 +387,12 @@ impl RPC {
}
pub fn start(addr: SocketAddr, query: Arc<Query>) -> RPC {
let (notification_tx, notification_rx) = channel();
let (tx, rx) = channel();
let listener = TcpListener::bind(addr).expect(&format!("bind({}) failed", addr));
info!("RPC server running on {}", addr);
thread::spawn(move || {
let senders = Arc::new(Mutex::new(Vec::<SyncSender<Message>>::new()));
RPC::start_notification_worker(notification_rx, senders.clone());
RPC::start_notification_worker(rx, senders.clone());
loop {
let (stream, addr) = listener.accept().expect("accept failed");
let query = query.clone();
@ -406,9 +406,7 @@ impl RPC {
});
}
});
RPC {
notification: notification_tx,
}
RPC { notification: tx }
}
pub fn notify(&self) {