Files
solana/src/server.rs

50 lines
1.1 KiB
Rust
Raw Normal View History

2018-05-15 11:00:01 -06:00
//! The `server` module hosts all the server microservices.
use bank::Bank;
use crdt::ReplicatedData;
use hash::Hash;
use rpu::Rpu;
use std::io::Write;
use std::net::UdpSocket;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::thread::JoinHandle;
use std::time::Duration;
pub struct Server {
pub thread_hdls: Vec<JoinHandle<()>>,
}
impl Server {
pub fn new<W: Write + Send + 'static>(
bank: Bank,
start_hash: Hash,
tick_duration: Option<Duration>,
me: ReplicatedData,
requests_socket: UdpSocket,
2018-05-15 11:19:58 -06:00
_events_socket: UdpSocket,
2018-05-15 11:00:01 -06:00
broadcast_socket: UdpSocket,
respond_socket: UdpSocket,
gossip: UdpSocket,
exit: Arc<AtomicBool>,
writer: W,
) -> Self {
2018-05-15 11:21:40 -06:00
let bank = Arc::new(bank);
2018-05-15 11:00:01 -06:00
let rpu = Rpu::new(
2018-05-15 11:21:40 -06:00
bank.clone(),
2018-05-15 11:00:01 -06:00
start_hash,
tick_duration,
me,
requests_socket,
broadcast_socket,
respond_socket,
gossip,
exit,
writer,
);
Server {
thread_hdls: rpu.thread_hdls,
}
}
}