[bug #56022] MQTT: PINGREQ check wrong

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #56022] MQTT: PINGREQ check wrong

Wilfred
URL:
  <https://savannah.nongnu.org/bugs/?56022>

                 Summary: MQTT: PINGREQ check wrong
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: giusloq
            Submitted on: Thu 28 Mar 2019 04:17:35 PM UTC
                Category: apps
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56022>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #56022] MQTT: PINGREQ check wrong

Wilfred
Update of bug #56022 (project lwip):

              Item Group:                    None => Faulty Behaviour      
                  Status:                    None => Fixed                  
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #1:

Fixxed with patch #9813.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56022>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel