pub fn handle_publish(&mut self, qos: QoS, id: u16, packet: &[u8]) {
        // This is not called for QoS 0 and QoS 2 is not implemented yet
        assert_eq!(qos, QoS::AtLeastOnce);

        let mut buf: Vec<u8, MSG_SIZE> = Vec::from_slice(packet).unwrap();
        // Set DUP = 1 (bit 3). If this packet is ever read it's just because we want to resend it
        buf[0] |= 1 << 3;
        // If this fails and the PUBACK will be received and Client (minimq) should disconnect from server with 0x82 Protocol Error
        // This behaviour pretty much reverts this message to QoS 0 with a restart if the message is actually delivered
        let _ = self.pending_publish.insert(id, buf);
        let _ = self.pending_publish_ordering.push(id);
    }
/// Called when publish with QoS 1 is called so that we can keep track of PUBACK
Called when publish with QoS 1 is called so that we can keep track of PUBACK
Called when publish with QoS 1 is called so that we can keep track of PUBACK
pub fn handle_publish(&mut self, qos: QoS, id: u16, packet: &[u8]) {
        // This is not called for QoS 0 and QoS 2 is not implemented yet
        assert_eq!(qos, QoS::AtLeastOnce);
        let mut buf: Vec<u8, MSG_SIZE> = Vec::from_slice(packet).unwrap();
        // Set DUP = 1 (bit 3). If this packet is ever read it's just because we want to resend it
        buf[0] |= 1 << 3;
        // If this fails and the PUBACK will be received and Client (minimq) should disconnect from server with 0x82 Protocol Error
        // This behaviour pretty much reverts this message to QoS 0 with a restart if the message is actually delivered
        let _ = self.pending_publish.insert(id, buf);
        let _ = self.pending_publish_ordering.push(id);
    }
pub fn handle_publish ( & mut self , qos : QoS , id : u16 , packet : & [ u8 ] ) { // This is not called for QoS 0 and QoS 2 is not implemented yet assert_eq ! ( qos QoS AtLeastOnce ) ; let mut buf : Vec < u8 , MSG_SIZE > = Vec :: from_slice ( packet ) . unwrap ( ) ; // Set DUP = 1 (bit 3). If this packet is ever read it's just because we want to resend it buf [ 0 ] |= 1 << 3 ; // If this fails and the PUBACK will be received and Client (minimq) should disconnect from server with 0x82 Protocol Error // This behaviour pretty much reverts this message to QoS 0 with a restart if the message is actually delivered let _ = self . pending_publish . insert ( id , buf ) ; let _ = self . pending_publish_ordering . push ( id ) ; }
Called when publish with QoS 1 is called so that we can keep track of PUBACK
Called when publish with QoS 1 is called so that we can keep track of PUBACK
&mut self
qos
QoS
id
u16
packet
&[u8]