diff --git a/quinn-proto/src/endpoint.rs b/quinn-proto/src/endpoint.rs index 039a35733..f1eec363f 100644 --- a/quinn-proto/src/endpoint.rs +++ b/quinn-proto/src/endpoint.rs @@ -207,7 +207,7 @@ impl Endpoint { first_decode, remaining, }; - match route_to { + return match route_to { RouteDatagramTo::Incoming(incoming_idx) => { let incoming_buffer = &mut self.incoming_buffers[incoming_idx]; let config = &self.server_config.as_ref().unwrap(); @@ -226,15 +226,13 @@ impl Endpoint { self.all_incoming_buffers_total_bytes += datagram_len as u64; } - return None; - } - RouteDatagramTo::Connection(ch) => { - return Some(DatagramEvent::ConnectionEvent( - ch, - ConnectionEvent(ConnectionEventInner::Datagram(event)), - )) + None } - } + RouteDatagramTo::Connection(ch) => Some(DatagramEvent::ConnectionEvent( + ch, + ConnectionEvent(ConnectionEventInner::Datagram(event)), + )), + }; } // @@ -301,12 +299,7 @@ impl Endpoint { // connection. Send a stateless reset if possible. // - if !first_decode.is_initial() - && self - .local_cid_generator - .validate(first_decode.dst_cid()) - .is_err() - { + if !first_decode.is_initial() && self.local_cid_generator.validate(dst_cid).is_err() { debug!("dropping packet with invalid CID"); return None; }