/// Iterates through the list of stored publishes and removes the publish with the
/// matching packet identifier. Removal is now a O(n) operation. This should be
/// usually ok in case of acks due to ack ordering in normal conditions. But in cases
/// where the broker doesn't guarantee the order of acks, the performance won't be optimal
Iterates through the list of stored publishes and removes the publish with the
matching packet identifier. Removal is now a O(n) operation. This should be
usually ok in case of acks due to ack ordering in normal conditions. But in cases
where the broker doesn't guarantee the order of acks, the performance won't be optimal
Iterates through the list of stored publishes and removes the publish with the matching packet identifier . Removal is now a O ( n ) operation . This should be usually ok in case of acks due to ack ordering in normal conditions . But in cases where the broker doesn ' t guarantee the order of acks the performance won ' t be optimal
fn handle_incoming_pubrec(
        &mut self,
        pid: Pid,
    ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
        if self.outgoing_pub.contains_key(&pid.get()) {
            self.outgoing_pub.remove(&pid.get());
            self.outgoing_rel
                .insert(pid.get())
                .map_err(|_| StateError::InvalidState)?;
            let reply = Some(Packet::Pubrel(pid));
            let notification = Some(Notification::Pubrec(pid));
            Ok((notification, reply))
        } else {
            mqtt_log!(error, "Unsolicited pubrec packet: {:?}", pid.get());
            // Err(StateError::Unsolicited)
            Ok((None, None))
        }
    }
fn handle_incoming_pubrec ( & mut self , pid : Pid , ) -> Result < ( Option < Notification > , Option < Packet < ' static > > ) , StateError > { if self . outgoing_pub . contains_key ( & pid . get ( ) ) { self . outgoing_pub . remove ( & pid . get ( ) ) ; self . outgoing_rel . insert ( pid . get ( ) ) . map_err ( | _ | StateError :: InvalidState ) ? ; let reply = Some ( Packet :: Pubrel ( pid ) ) ; let notification = Some ( Notification :: Pubrec ( pid ) ) ; Ok ( ( notification , reply ) ) } else { mqtt_log ! ( error " " pid get ( ) ) ; // Err(StateError::Unsolicited) Ok ( ( None , None ) ) } }
Iterates through the list of stored publishes and removes the publish with the
matching packet identifier.
Iterates through the list of stored publishes and removes the publish with the matching packet identifier .
&mut self
pid
Pid