-
-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UDP connection can disconnect when heartbeats are not received #2074
UDP connection can disconnect when heartbeats are not received #2074
Conversation
Hmm does that work? It seems weird to set And when |
The thought is that if MAVSDK is sending heartbeats, then we should not be considered as always connected. The connection status should depend upon the status of the heartbeats. If MAVSDK is not sending heartbeats, then we have to assume the client either doesn't care about the connection or are implementing their own connection logic; in either case, MAVSDK should act as if it is always connected.
The point of the |
Another solution is to pass down the I am of the opinion that if MAVSDK is sending heartbeats, then it should also monitor and broadcast (via callbacks) the status of the connection based on those heartbeats, and so it should be automatic as I have written it. Though I would accept either solution. |
Thanks @jperez-droneup! @JonasVautherin I wonder why we need that I'm gonna try to make a PR where I just remove that flag alltogether and see where it leads. |
This is my alternative fix: #2077 @jperez-droneup it would be great if you could test this one to check whether it works for you. |
Your fix does indeed fix the issue, so the connection status change callback is properly firing. However, I am still seeing the issue from case1 of #2075, just FYI. |
Just to be sure I understand correctly. Case one of #2075 is not fixed by this PR (#2074), is it? In other words, does that mean that this (#2074) could be closed in favor of #2077, but issue #2075 is still open because of its case 1? |
That is correct. I would rather you just remove the always_connected flag altogether than my approach to work around it. And yes #2075 is still present in case1. |
Thanks for the PR but I'm closing it because I prefer removing the |
Yeah thanks a lot @jperez-droneup! The whole discussion and your insights were very useful! |
Creating a UDP connection to a vehicle/simulator via
setup_udp_remote
oradd_any_connection
will set thealways_connected
flag to true in all cases. This means that even though MAVSDK could be sending heartbeats (configured in theMavsdk::Configuration::_always_send_heartbeats
), the lack of response on those heartbeats does not lead to realizing/announcing the disconnect. With this change, if the Mavsdk will properly use heartbeats to detect connection and disconnection if it is configured to send those heartbeats. This means that the system will not be considered connected (and fire thesubscribe_on_new_system
callback) until the first heartbeat response is received, and will be considered disconnected (and fire thesubscribe_is_connected
callback) when the configured amount of time passes without a heartbeat response.