Minor timers fix

This commit is contained in:
arkpar 2016-01-16 13:29:51 +01:00
parent c224808416
commit 69f1f310b6

View File

@ -600,14 +600,12 @@ impl<Message> IoHandler<NetworkIoMessage<Message>> for Host<Message> where Messa
FIRST_CONNECTION ... LAST_CONNECTION => self.connection_timeout(token, io), FIRST_CONNECTION ... LAST_CONNECTION => self.connection_timeout(token, io),
NODETABLE_DISCOVERY => {}, NODETABLE_DISCOVERY => {},
NODETABLE_MAINTAIN => {}, NODETABLE_MAINTAIN => {},
_ => { _ => match self.timers.get_mut(&token).map(|p| *p) {
let protocol = *self.timers.get_mut(&token).expect("Unknown user timer token"); Some(protocol) => match self.handlers.get_mut(protocol) {
match self.handlers.get_mut(protocol) {
None => { warn!(target: "net", "No handler found for protocol: {:?}", protocol) }, None => { warn!(target: "net", "No handler found for protocol: {:?}", protocol) },
Some(h) => { Some(h) => { h.timeout(&mut NetworkContext::new(io, protocol, Some(token), &mut self.connections, &mut self.timers), token); }
h.timeout(&mut NetworkContext::new(io, protocol, Some(token), &mut self.connections, &mut self.timers), token); },
} None => {} // time not registerd through us
}
} }
} }
} }