-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Missing code section in Server
It seems at some point a section of code was omitted "to be done", but never got added.
Obiously, the content of the Ok() block is the serve function defined in the same file, but I would like to see how you had implemented it.
Thanks for writing this interesting book!
Relevant code: Line 43 to 67 in the complete_blockchain/src/server.rs file.
pub fn run(&self, addr: &str) {
let listener = TcpListener::bind(addr).unwrap();
if addr.eq(CENTERAL_NODE) == false {
let best_height = self.blockchain.get_best_height();
send_version(CENTERAL_NODE, best_height);
}
for stream in listener.incoming() {
let blockchain = self.blockchain.clone();
thread::spawn(|| match stream {
Ok(stream) => {
...
}
Err(e) => {
...
}
});
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels