buglwIP - A Lightweight TCP/IP stack - Bugs: bug #56022, MQTT: PINGREQ check wrong


You are not allowed to post comments on this tracker with your current authentication level.

bug #56022: MQTT: PINGREQ check wrong

Submitted by:  Giuseppe Modugno <giusloq>
Submitted on:  Thu 28 Mar 2019 04:17:35 PM UTC  
Category:  apps Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 11 Jun 2019 07:14:49 PM UTC, comment #1: 

Fixxed with patch #9813.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 28 Mar 2019 04:17:35 PM UTC, original submission:  

In mqtt_cyclic_timer() you check if it's time to send a new PINGREQ, based on client->keep_alive and client->cyclick_tick.
The if statement is:

if ((client->cyclic_tick * MQTT_CYCLIC_TIMER_INTERVAL) >= client->keep_alive) {

After connection mqtt_cyclic_timer() is fired after MQTT_CYCLIC_TIMER_INTERVAL. Now suppose MQTT_CYCLIC_TIMER_INTERVAL is 5 seconds and client->keep_alive is 5 seconds. The first time mqtt_cyclic_timer() is called, it should send PINGREQ. However it doesn't, because client->cyclic_tick is zero.

I think it's better to preincrement client->cyclic_tick to take into account the first period that was already expired. Of course, the increment of client->cyclic_tick should be deleted on the else branch.

Giuseppe Modugno <giusloq>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by giusloq (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-11 goldsimon Item GroupNone => Faulty Behaviour
        StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5