Verified Commit 63bd8f5d authored by Andronik Ordian's avatar Andronik Ordian
Browse files

filter out event stream

parent 41d66a46
Pipeline #143225 passed with stages
in 33 minutes and 46 seconds
......@@ -594,15 +594,16 @@ where
async fn handle_network_messages<AD: validator_discovery::AuthorityDiscovery>(
mut sender: impl SubsystemSender,
mut network_service: impl Network,
mut network_stream: BoxStream<'static, NetworkEvent>,
network_stream: BoxStream<'static, NetworkEvent>,
mut authority_discovery_service: AD,
mut request_multiplexer: RequestMultiplexer,
metrics: Metrics,
shared: Shared,
) -> Result<(), UnexpectedAbort> {
let mut network_stream = network_stream.fuse();
loop {
futures::select! {
network_event = network_stream.next().fuse() => match network_event {
network_event = network_stream.next() => match network_event {
None => return Err(UnexpectedAbort::EventStreamConcluded),
Some(NetworkEvent::Dht(_))
| Some(NetworkEvent::SyncConnected { .. })
......@@ -870,7 +871,7 @@ where
authority_discovery_service,
metrics,
sync_oracle,
} = bridge;
} = bridge;
let statement_receiver = request_multiplexer
.get_statement_fetching()
......
......@@ -123,7 +123,14 @@ pub trait Network: Clone + Send + 'static {
#[async_trait]
impl Network for Arc<NetworkService<Block, Hash>> {
fn event_stream(&mut self) -> BoxStream<'static, NetworkEvent> {
NetworkService::event_stream(self, "polkadot-network-bridge").boxed()
NetworkService::event_stream(self, "polkadot-network-bridge").filter_map(|e| async move {
match e {
NetworkEvent::NotificationStreamOpened { .. }
| NetworkEvent::NotificationStreamClosed { .. }
| NetworkEvent::NotificationsReceived { .. } => Some(e),
_ => None,
}
}).boxed()
}
async fn add_to_peers_set(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment