mirror of https://github.com/dswd/vpncloud.git
Extending peer timeout on peer message
This commit is contained in:
parent
937c7b9f3b
commit
1da38f5205
|
@ -97,6 +97,13 @@ impl PeerList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn refresh(&mut self, addr: &SocketAddr) {
|
||||||
|
if let Some(&mut (ref mut timeout, _node_id, ref _alt_addrs)) = self.peers.get_mut(addr) {
|
||||||
|
*timeout = now()+self.timeout as Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add_alt_addr(&mut self, node_id: NodeId, addr: SocketAddr) {
|
fn add_alt_addr(&mut self, node_id: NodeId, addr: SocketAddr) {
|
||||||
if let Some(main_addr) = self.nodes.get(&node_id) {
|
if let Some(main_addr) = self.nodes.get(&node_id) {
|
||||||
|
@ -512,6 +519,8 @@ impl<P: Protocol> GenericCloud<P> {
|
||||||
try!(self.connect(p));
|
try!(self.connect(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Refresh peer
|
||||||
|
self.peers.refresh(&peer);
|
||||||
},
|
},
|
||||||
Message::Init(stage, node_id, ranges) => {
|
Message::Init(stage, node_id, ranges) => {
|
||||||
// Avoid connecting to self
|
// Avoid connecting to self
|
||||||
|
|
Loading…
Reference in New Issue