Skip to main content

find_matching

Function find_matching 

Source
pub fn find_matching(
    queue: &[UdpRxEntry],
    dst_port: u16,
    pred: impl Fn(&UdpRxEntry) -> bool,
) -> Option<usize>
Expand description

宛先ポートが一致し、かつ述語を満たすエントリのうち最も古いものの 添字を返す(取り出しは呼び出し側が行う)。

最も古いものを選ぶのは、同一問い合わせに対して複数サーバから応答が 返る DNS のようなケースで、先に届いた応答から順に消費するため。