Improved peer reconnection code.

This commit is contained in:
Revertron committed 2021-02-20 21:36:58 +01:00
1 parent 93d688c479
commit 483be5215a
7 files changed
+133 -55

No files matched your search

+8
View File
@@ -24,6 +24,10 @@ impl Peer {
&mut self.stream
}
pub fn set_stream(&mut self, stream: TcpStream) {
self.stream = stream;
}
pub fn get_state(&self) -> &State {
&self.state
}
@@ -48,6 +52,10 @@ impl Peer {
self.state.disabled()
}
pub fn is_inbound(&self) -> bool {
self.inbound
}
/// If loopback address then we care about ip and port.
/// If regular address then we only care about the ip and ignore the port.
pub fn equals(&self, addr: &SocketAddr) -> bool {