Files
solana/src/server.rs

65 lines
1.5 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;
//use tpu::Tpu;
2018-05-15 11:00:01 -06:00
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);
let mut thread_hdls = vec![];
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.clone(),
2018-05-15 11:00:01 -06:00
writer,
);
thread_hdls.extend(rpu.thread_hdls);
//let tpu = Tpu::new(
// bank.clone(),
// start_hash,
// tick_duration,
// me,
// events_socket,
// broadcast_socket,
// gossip,
// exit.clone(),
// writer,
//);
//thread_hdls.extend(tpu.thread_hdls);
Server { thread_hdls }
2018-05-15 11:00:01 -06:00
}
}