Use self.config.idle_timeout in Kademlia handler (#1635)

This commit is contained in:
Pierre Krieger
2020-06-30 07:50:45 +02:00
committed by GitHub
parent 823c747904
commit 9049591d46

View File

@ -632,7 +632,7 @@ where
} }
(None, Some(event), _) => { (None, Some(event), _) => {
if self.substreams.is_empty() { if self.substreams.is_empty() {
self.keep_alive = KeepAlive::Until(Instant::now() + Duration::from_secs(10)); self.keep_alive = KeepAlive::Until(Instant::now() + self.config.idle_timeout);
} }
return Poll::Ready(event); return Poll::Ready(event);
} }
@ -653,7 +653,7 @@ where
if self.substreams.is_empty() { if self.substreams.is_empty() {
// We destroyed all substreams in this function. // We destroyed all substreams in this function.
self.keep_alive = KeepAlive::Until(Instant::now() + Duration::from_secs(10)); self.keep_alive = KeepAlive::Until(Instant::now() + self.config.idle_timeout);
} else { } else {
self.keep_alive = KeepAlive::Yes; self.keep_alive = KeepAlive::Yes;
} }