Explorar o código

packet assembler: remove unused Error::PacketAssemblerOverlap

Dario Nieuwenhuis %!s(int64=2) %!d(string=hai) anos
pai
achega
40269822a3
Modificáronse 4 ficheiros con 2 adicións e 20 borrados
  1. 0 1
      src/iface/fragmentation.rs
  2. 2 9
      src/iface/interface/ipv4.rs
  3. 0 5
      src/iface/interface/sixlowpan.rs
  4. 0 5
      src/lib.rs

+ 0 - 1
src/iface/fragmentation.rs

@@ -103,7 +103,6 @@ impl<'a> PacketAssembler<'a> {
     ///
     /// - Returns [`Error::PacketAssemblerBufferTooSmall`] when trying to add data into the buffer at a non-existing
     /// place.
-    /// - Returns [`Error::PacketAssemblerOverlap`] when there was an overlap when adding data.
     pub(crate) fn add(&mut self, data: &[u8], offset: usize) -> Result<bool> {
         let offset = offset as isize + self.offset_correction;
         let offset = if offset <= 0 { 0 } else { offset as usize };

+ 2 - 9
src/iface/interface/ipv4.rs

@@ -39,7 +39,7 @@ impl<'a> InterfaceInner<'a> {
 
         #[cfg(feature = "proto-ipv4-fragmentation")]
         let ip_payload = {
-            const REASSEMBLY_TIMEOUT: u64 = 90;
+            const REASSEMBLY_TIMEOUT: Duration = Duration::from_secs(90);
 
             let fragments = _fragments.unwrap();
 
@@ -58,11 +58,7 @@ impl<'a> InterfaceInner<'a> {
                             e => check!(e),
                         };
 
-                        check!(p.start(
-                            None,
-                            self.now + Duration::from_secs(REASSEMBLY_TIMEOUT),
-                            0
-                        ));
+                        check!(p.start(None, self.now + REASSEMBLY_TIMEOUT, 0));
 
                         check!(fragments.get_packet_assembler_mut(&key))
                     }
@@ -86,9 +82,6 @@ impl<'a> InterfaceInner<'a> {
                     Ok(false) => {
                         return None;
                     }
-                    Err(Error::PacketAssemblerOverlap) => {
-                        return None;
-                    }
                     Err(e) => {
                         net_debug!("fragmentation error: {}", e);
                         return None;

+ 0 - 5
src/iface/interface/sixlowpan.rs

@@ -272,11 +272,6 @@ impl<'a> InterfaceInner<'a> {
                 }
             }
             Ok(false) => None,
-            Err(Error::PacketAssemblerOverlap) => {
-                net_trace!("6LoWPAN: overlap in packet");
-                frags.reset();
-                None
-            }
             Err(_) => None,
         }
     }

+ 0 - 5
src/lib.rs

@@ -190,8 +190,6 @@ pub enum Error {
     PacketAssemblerIncomplete,
     /// There are too many holes in the packet assembler (should be fixed in the future?).
     PacketAssemblerTooManyHoles,
-    /// There was an overlap when adding data to the packet assembler.
-    PacketAssemblerOverlap,
 
     /// The packet assembler set has no place for assembling a new stream of fragments.
     PacketAssemblerSetFull,
@@ -231,9 +229,6 @@ impl fmt::Display for Error {
                 f,
                 "packet assembler has too many holes (internal smoltcp error)"
             ),
-            Error::PacketAssemblerOverlap => {
-                write!(f, "overlap when adding data to packet assembler")
-            }
             Error::PacketAssemblerSetFull => write!(f, "packet assembler set is full"),
             Error::PacketAssemblerSetKeyNotFound => {
                 write!(f, "packet assembler set does not find key")