diff --git a/roles/tests-integration/lib/sniffer.rs b/roles/tests-integration/lib/sniffer.rs index d4c3f4ce7..7d6f4a4da 100644 --- a/roles/tests-integration/lib/sniffer.rs +++ b/roles/tests-integration/lib/sniffer.rs @@ -289,23 +289,7 @@ impl Sniffer { continue; } let (msg_type, msg) = Self::message_from_frame(&mut frame); - let action = action.as_ref().and_then(|action| match action { - Action::BlockFromMessage(bm) - if bm.direction == MessageDirection::ToUpstream - && bm.expected_message_type == msg_type => - { - Some(action) - } - - Action::InterceptMessage(im) - if im.direction == MessageDirection::ToUpstream - && im.expected_message_type == msg_type => - { - Some(action) - } - - _ => None, - }); + let action = Action::filter_downstream(&action, msg_type, MessageDirection::ToUpstream); if let Some(ref action) = action { match action { Action::IgnoreFromMessage(_) => { @@ -354,23 +338,8 @@ impl Sniffer { } let (msg_type, msg) = Self::message_from_frame(&mut frame); - let action = action.as_ref().and_then(|action| match action { - Action::BlockFromMessage(bm) - if bm.direction == MessageDirection::ToDownstream - && bm.expected_message_type == msg_type => - { - Some(action) - } - - Action::InterceptMessage(im) - if im.direction == MessageDirection::ToDownstream - && im.expected_message_type == msg_type => - { - Some(action) - } - - _ => None, - }); + let action = + Action::filter_downstream(&action, msg_type, MessageDirection::ToDownstream); if let Some(ref action) = action { match action {