Check connected flag before reconnecting#28
Conversation
|
joelguittet
left a comment
There was a problem hiding this comment.
Hello @vincentb1 I would expect this to not occur with the example because the mender client is not requesting connection if already connected. Can you detail the error you get without this patch? Also please indicate your ESP-IDF version so that I can check.
Except this question, the modification looks good and provide a better network management so I don't see any reason not to do it. Can you add the same management on MENDER_CLIENT_EVENT_DISCONNECT event too? eg checking it is connected before disconnecting. This is done actually only when MENDER_CLIENT_EVENT_RESTART is received, but this can be ported to the normal use case (see my comment review in the source file).
There was a problem hiding this comment.
To provide complete network management properly you can check here for connected flag so that network_disconnect is called only if we are already connected.
There was a problem hiding this comment.
@joelguittet This can happen in corner cases : I had configured a short period for polling the server in order for my tests to go faster (a period only slightly longer than the download time), and the connection/deconnection not being instant I had some occurrence when the Mender client was trying to reconnect whereas some existing connection was still not fully released.
I think that adding this test does not eat any bread, so why not ? If you agree that it brings some value, then I propose that I provide some commission on top of it in order to factorize code and reduce if blocks imbrication depth (for code quality check to stop barking).
There was a problem hiding this comment.
That's fine for me. Just to be clear: this application focus on mender integration, not spurious network events, but I'm fine to review and test improvements of course.
Please just notice I have not refactor because in case of restart requested, then I accept few connections again before restarting (so that we can notice of download status "restarting"). Also please note that when disconnection is requested, there is a 10 seconds delay before doing this, in case a connection is wanted again.
|
@vincentb1 hello |
6db4fb6 to
4ee1269
Compare
|
|
Dear @joelguittet, |
|
Superseded by #31 |




Without this check, the example_connect may receive spurious calls.