{"action":"created","issue":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1683","labels_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1683/labels{/name}","comments_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1683/comments","events_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1683/events","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1683","id":91332902,"number":1683,"title":"Fixing Qt event loop issue where UDP readReady signal would not work.","user":{"login":"dogmaphobic","id":749243,"avatar_url":"https://avatars.githubusercontent.com/u/749243?v=3","gravatar_id":"","url":"https://api.github.com/users/dogmaphobic","html_url":"https://github.com/dogmaphobic","followers_url":"https://api.github.com/users/dogmaphobic/followers","following_url":"https://api.github.com/users/dogmaphobic/following{/other_user}","gists_url":"https://api.github.com/users/dogmaphobic/gists{/gist_id}","starred_url":"https://api.github.com/users/dogmaphobic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogmaphobic/subscriptions","organizations_url":"https://api.github.com/users/dogmaphobic/orgs","repos_url":"https://api.github.com/users/dogmaphobic/repos","events_url":"https://api.github.com/users/dogmaphobic/events{/privacy}","received_events_url":"https://api.github.com/users/dogmaphobic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-26T18:54:30Z","updated_at":"2015-06-26T20:21:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/pulls/1683","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1683","diff_url":"https://github.com/mavlink/qgroundcontrol/pull/1683.diff","patch_url":"https://github.com/mavlink/qgroundcontrol/pull/1683.patch"},"body":"For whatever reason, UDP connections would some times stop working. What I've found was that the ```readReady()``` signal would stop being called (outgoing datagrams were being sent just fine though). When the Pixhawk/Companion computer link was set to 57600, this would happen rarely but when the speed was set to 900k, the problem would show up quite often. In the case of the Android build, the issue was consistent at any speed and quite soon. As far as I could tell, Qt was getting stuck on a ```select()``` call and could not recover.\r\n\r\nThe fix was to stop using the ```readReady()``` signal and running my own loop. In the process, I also moved the *writes* to the link thread (it used to be in the MavLinkProtocol thread).\r\n\r\nIn addition, I've changed the addressing to ```AnyIPv4``` instead of ```Any```. On Qt 5.5, even though the connection was using IPv4, the *peer address* was being returned using IPv6 scheme and messing everything up. As nothing else in the pipeline supports IPv6, I saw no reason to allow binding to IPv6 interfaces.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/comments/115867799","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1683#issuecomment-115867799","issue_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1683","id":115867799,"user":{"login":"Nyaruko","id":2089248,"avatar_url":"https://avatars.githubusercontent.com/u/2089248?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyaruko","html_url":"https://github.com/Nyaruko","followers_url":"https://api.github.com/users/Nyaruko/followers","following_url":"https://api.github.com/users/Nyaruko/following{/other_user}","gists_url":"https://api.github.com/users/Nyaruko/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyaruko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyaruko/subscriptions","organizations_url":"https://api.github.com/users/Nyaruko/orgs","repos_url":"https://api.github.com/users/Nyaruko/repos","events_url":"https://api.github.com/users/Nyaruko/events{/privacy}","received_events_url":"https://api.github.com/users/Nyaruko/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T20:21:22Z","updated_at":"2015-06-26T20:21:22Z","body":"May I ask on what system you meet this problem? Since I have used udplink\nunder windows for quite a long time and never see this problem?\nOn 27 Jun 2015 2:54 am, \"Gus Grubba\" <notifications@github.com> wrote:\n\n> For whatever reason, UDP connections would some times stop working. What\n> I've found was that the readReady() signal would stop being called\n> (outgoing datagrams were being sent just fine though). When the\n> Pixhawk/Companion computer link was set to 57600, this would happen rarely\n> but when the speed was set to 900k, the problem would show up quite often.\n> In the case of the Android build, the issue was consistent at any speed and\n> quite soon. As far as I could tell, Qt was getting stuck on a select()\n> call and could not recover.\n>\n> The fix was to stop using the readReady() signal and running my own loop.\n> In the process, I also moved the *writes* to the link thread (it used to\n> be in the MavLinkProtocol thread).\n>\n> In addition, I've changed the addressing to AnyIPv4 instead of Any. On Qt\n> 5.5, even though the connection was using IPv4, the *peer address* was\n> being returned using IPv6 scheme and messing everything up. As nothing else\n> in the pipeline supports IPv6, I saw no reason to allow binding to IPv6\n> interfaces.\n> ------------------------------\n> You can view, comment on, or merge this pull request online at:\n>\n>   https://github.com/mavlink/qgroundcontrol/pull/1683\n> Commit Summary\n>\n>    - Fixing Qt event loop issue where UDP readReady signal would stop\n>    working.\n>\n> File Changes\n>\n>    - *M* src/comm/UDPLink.cc\n>    <https://github.com/mavlink/qgroundcontrol/pull/1683/files#diff-0>\n>    (100)\n>    - *M* src/comm/UDPLink.h\n>    <https://github.com/mavlink/qgroundcontrol/pull/1683/files#diff-1>\n>    (10)\n>\n> Patch Links:\n>\n>    - https://github.com/mavlink/qgroundcontrol/pull/1683.patch\n>    - https://github.com/mavlink/qgroundcontrol/pull/1683.diff\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/mavlink/qgroundcontrol/pull/1683>.\n>\n"}}