(&self, addr: &str)
| 46 | } |
| 47 | |
| 48 | pub fn run(&self, addr: &str) { |
| 49 | let listener = TcpListener::bind(addr).unwrap(); |
| 50 | |
| 51 | if addr.eq(CENTERAL_NODE) == false { |
| 52 | let best_height = self.blockchain.get_best_height(); |
| 53 | send_version(CENTERAL_NODE, best_height); |
| 54 | } |
| 55 | for stream in listener.incoming() { |
| 56 | let blockchain = self.blockchain.clone(); |
| 57 | thread::spawn(|| match stream { |
| 58 | Ok(stream) => { |
| 59 | ... |
| 60 | } |
| 61 | Err(e) => { |
| 62 | ... |
| 63 | } |
| 64 | }); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | #[derive(Debug, Serialize, Deserialize)] |
nothing calls this directly
no test coverage detected