Do not use Instant::now when zero reset streams are configured. (#537)
This allows to use `h2` on wasm platforms which lack an `Instant::now` implementation by setting the number of streams to 0 with: `h2::client::Builder::max_concurrent_reset_streams`.
This commit is contained in:
@@ -866,6 +866,7 @@ impl Recv {
|
||||
}
|
||||
|
||||
pub fn clear_expired_reset_streams(&mut self, store: &mut Store, counts: &mut Counts) {
|
||||
if !self.pending_reset_expired.is_empty() {
|
||||
let now = Instant::now();
|
||||
let reset_duration = self.reset_duration;
|
||||
while let Some(stream) = self.pending_reset_expired.pop_if(store, |stream| {
|
||||
@@ -875,6 +876,7 @@ impl Recv {
|
||||
counts.transition_after(stream, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_queues(
|
||||
&mut self,
|
||||
|
||||
@@ -304,6 +304,10 @@ where
|
||||
None
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.indices.is_none()
|
||||
}
|
||||
|
||||
pub fn pop_if<'a, R, F>(&mut self, store: &'a mut R, f: F) -> Option<store::Ptr<'a>>
|
||||
where
|
||||
R: Resolve,
|
||||
|
||||
Reference in New Issue
Block a user