BRouter server response: connection denied (still occuring)

Issue #373 resolved
Jürgen Beck created an issue

I have built QMS from today's development source for to check if issue #355 got resolved by current method of determining BRouter local server's ready-for-connect state. I encountered 3 different behaviours which make me believe that method is not yet reliable.

  1. Rarely - Message "connection denied" in QMS window still occurs
  2. Mostly - Message "connection denied" does not occur
  3. Sometimes - Message "connection denied" does not occur but terminal window shows warning message
[warning] QAbstractSocket::waitForDisconnected() is not allowed in UnconnectedState

Then I inserted following debug line of code after count loop ...

printf("connected=%d counts=%d\n",connected?1:0,counts);fflush(stdout);

... and noticed following cases:

  • Case 3 - connected=1 counts>0 - Connecting socket to BRouter process succeeded within 10 attempts, i.e 10*100 msec = 1 second
  • Case 2 - connected=0 counts=0 - Connecting did not succeed within 10 attempts or 1 sec. Nevertheless 1 second delay was enough for BRouter process to become ready for accepting connection when starting new track.
  • Case 1 - connected=0 counts=0 - Connecting did not succeed within 10 attempts or 1 sec. BRouter process was still not ready for accepting connection. Increasing attempt count to 50 i.e. 5 seconds did help.

To avoiding warning message in case 3, modifying following line of code helps:

- socket.waitForDisconnected();
+ if (socket.state() != QAbstractSocket::UnconnectedState) socket.waitForDisconnected();

Comments (3)

  1. Norbert Truchsess

    thank you for the detailed analysis. Currenty I'm very busy but next week I have vacation and plenty of time to refine this fix. :-)

  2. Norbert Truchsess

    I see that the documentation says waitforconnected() is unreliable on Windows and one should rather use connected signal. New Fix is using this signal-based approach (with local EventLoop). Timeout increased to 30 sec (plus Progressdialog so you may cancel if you feel that something else went wrong)

  3. Log in to comment