fn handle_outgoing_publish(
        &mut self,
        request: &mut SerializedPacket<'_>,
        now: &TIM,
    ) -> Result<(), StateError> {
        match request.header()?.qos {
            QoS::AtMostOnce => {}
            QoS::AtLeastOnce => {
                let pid = self.next_pid();
                self.outgoing_pub
                    .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
                    .map_err(|_| StateError::MaxMessagesInflight)?;
                request.set_pid(pid)?;
            }
            QoS::ExactlyOnce => {
                let pid = self.next_pid();
                self.outgoing_pub
                    .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
                    .map_err(|_| StateError::MaxMessagesInflight)?;
                request.set_pid(pid)?;
            }
        }
        Ok(())
    }
/// Adds next packet identifier to QoS 1 and 2 publish packets and returns
/// it by wrapping publish in packet
Adds next packet identifier to QoS 1 and 2 publish packets and returns
it by wrapping publish in packet
Adds next packet identifier to QoS 1 and 2 publish packets and returns it by wrapping publish in packet
fn handle_outgoing_publish(
        &mut self,
        request: &mut SerializedPacket<'_>,
        now: &TIM,
    ) -> Result<(), StateError> {
        match request.header()?.qos {
            QoS::AtMostOnce => {}
            QoS::AtLeastOnce => {
                let pid = self.next_pid();
                self.outgoing_pub
                    .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
                    .map_err(|_| StateError::MaxMessagesInflight)?;
                request.set_pid(pid)?;
            }
            QoS::ExactlyOnce => {
                let pid = self.next_pid();
                self.outgoing_pub
                    .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
                    .map_err(|_| StateError::MaxMessagesInflight)?;
                request.set_pid(pid)?;
            }
        }
        Ok(())
    }
fn handle_outgoing_publish ( & mut self , request : & mut SerializedPacket < ' _ > , now : & TIM , ) -> Result < ( ) , StateError > { match request . header ( ) ? . qos { QoS :: AtMostOnce => { } QoS :: AtLeastOnce => { let pid = self . next_pid ( ) ; self . outgoing_pub . insert ( pid . get ( ) , Inflight :: new ( StartTime :: new ( * now ) , & request . 0 ) ) . map_err ( | _ | StateError :: MaxMessagesInflight ) ? ; request . set_pid ( pid ) ? ; } QoS :: ExactlyOnce => { let pid = self . next_pid ( ) ; self . outgoing_pub . insert ( pid . get ( ) , Inflight :: new ( StartTime :: new ( * now ) , & request . 0 ) ) . map_err ( | _ | StateError :: MaxMessagesInflight ) ? ; request . set_pid ( pid ) ? ; } } Ok ( ( ) ) }
Adds next packet identifier to QoS 1 and 2 publish packets and returns
it by wrapping publish in packet
Adds next packet identifier to QoS 1 and 2 publish packets and returns it by wrapping publish in packet
&mut self
request
&mut SerializedPacket<'_>
now
&TIM
&mut self
request
&mut SerializedPacket<'_>
now
&TIM