MQTT QOS1 resending packet

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
vtunr
Level 4
Level 4
10 likes received 5 sign-ins First like received

Hi,

I'm using WICED SDK 4.0.1 and using the MQTT library.

I found a small problem on QOS1.

Here's what i do :

  • Publish something every 30s
  • Keepalive of 10s

Both start when i receive a CONNACK.

After a while, we have this kind of event :

PING

PUBLISH packet 1

PINGRES => rePUBLISH packet 1 because still in the queue

PUBACK from packet 1

PUBACK from packet 1

and all of that in a few millisecond

Thing is, when you receive two puback from the same packet, you end up here :

if ( mqtt_session_remove_item( MQTT_PACKET_TYPE_PUBLISH, puback_args->packet_id, conn->session ) != WICED_SUCCESS ){ 
       WPRINT_LIB_ERROR( ("[MQTT] puback %d not in session queue.\n ", puback_args->packet_id) );  
}

So it can't continue. Changing to this avoid the problem, but is not solving the root cause i believe  :

if ( mqtt_session_remove_item( MQTT_PACKET_TYPE_PUBLISH, puback_args->packet_id, conn->session ) != WICED_SUCCESS ){
       WPRINT_APP_INFO(("[MQTT] Puback not in session\r\n"));                    
       return WICED_ERROR;               
}

I think there some room for improvement on that, because i believe QOS1 might lead to multiple PUBACK and currently in the library, it is considered as an error

Maybe in a next version of the MQTT library ?

Regards

vtunr

0 Likes
1 Reply