kopera / erlang-mqtt

Erlang/Elixir low level MQTT protocol implementation
Other
16 stars 5 forks source link

send ping periodically. #4

Closed harshadkopera closed 6 years ago

harshadkopera commented 6 years ago

I am not sure about the whole thing. But this is what I observed and thought is wrong. I might be completely wrong here. Here is the explanation :

Send ping periodically. This has been done because, our logic of send ping only when data is unavailable looks erroneous. We clear the keep_alive timer on every send ok. It has been observed that send Ok is the ack from gen-tcp to app. So even when the network is gone, we get send_ok. This dismisses our assumption where we treat send_ok as ack and resets the keep_alive timer. If we send the ping periodically, irrespective of data from device, we can detect the network availability correctly.

asabil commented 6 years ago

We should stop the exit timer whenever we stop the keep alive timer