Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Prev Previous commit
Next Next commit
Inline poll()
  • Loading branch information
tomaka committed Jun 26, 2019
commit f9c9c89358751835ed3235522d236c522d790eb6
24 changes: 6 additions & 18 deletions core/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,20 +512,6 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
}, rq);
}

pub fn poll(
&mut self
) -> Poll<void::Void, void::Void> {
while let Ok(Async::Ready(_)) = self.tick_timeout.poll() {
self.tick();
}

while let Ok(Async::Ready(_)) = self.propagate_timeout.poll() {
self.propagate_extrinsics();
}

Ok(Async::NotReady)
}

fn is_on_demand_response(&self, who: &PeerId, response_id: message::RequestId) -> bool {
self.on_demand_core.is_on_demand_response(&who, response_id)
}
Expand Down Expand Up @@ -1600,10 +1586,12 @@ Protocol<B, S, H> {
Self::OutEvent
>
> {
match self.poll() {
Ok(Async::Ready(v)) => void::unreachable(v),
Ok(Async::NotReady) => {}
Err(err) => void::unreachable(err),
while let Ok(Async::Ready(_)) = self.tick_timeout.poll() {
self.tick();
}

while let Ok(Async::Ready(_)) = self.propagate_timeout.poll() {
self.propagate_extrinsics();
}

let event = match self.behaviour.poll(params) {
Expand Down