Skip to content

Commit

Permalink
Cleanup code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
garious committed Jul 3, 2018
1 parent 88a6fb8 commit f388428
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions src/fullnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,41 +84,23 @@ impl FullNode {
server
} else {
node.data.current_leader_id = node.data.id.clone();
let server = match outfile_for_leader {
let outfile_for_leader: Box<Write + Send> = match outfile_for_leader {
Some(OutFile::Path(file)) => {
FullNode::new_leader(
bank,
entry_height,
//Some(Duration::from_millis(1000)),
None,
node,
exit.clone(),
File::create(file).expect("opening ledger file"),
)
}
Some(OutFile::StdOut) => {
FullNode::new_leader(
bank,
entry_height,
//Some(Duration::from_millis(1000)),
None,
node,
exit.clone(),
stdout(),
)
}
None => {
FullNode::new_leader(
bank,
entry_height,
//Some(Duration::from_millis(1000)),
None,
node,
exit.clone(),
sink(),
)
Box::new(File::create(file).expect("opening ledger file"))
}
Some(OutFile::StdOut) => Box::new(stdout()),
None => Box::new(sink()),
};

let server = FullNode::new_leader(
bank,
entry_height,
//Some(Duration::from_millis(1000)),
None,
node,
exit.clone(),
outfile_for_leader,
);
info!(
"leader ready... local request address: {} (advertising {})",
local_requests_addr, requests_addr
Expand Down

0 comments on commit f388428

Please sign in to comment.