Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Q
qtbase
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Labels
  • Merge Requests 5
    • Merge Requests 5
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Jobs
  • Commits
  • mer-core
  • qtbase
  • Merge Requests
  • !48

Merged
Opened Jun 28, 2019 by flypig@flypig
  • Report abuse
Report abuse

Ignore Connecting states received after session has closed

  • Overview 2
  • Commits 2
  • Changes 1

QNetworkManager keeps track of a single connected session (e.g. Wifi, mobile data) at a time. If the currently tracked session disconnects, it relies on receiving a status update from the session in order to trigger it to move to a different connection.

As part of this, it also relies on the signals it connects to from the QNetworkSession being queued, because QueuedConnection sends its closed() signal before it sends its Disconnected stateChanged() signal. QNetworkManager disconnects the signals on receiving the closed() signal, but still needs to receive the Disconnected stateChanged() signal in order to trigger a switch to a different connection.

Unfortunately, QNetworkSession can also send out Connecting stateChanged() signals after the closed() signal, and these are handled badly by QNetworkSession. The problemmatic sequence is:

  1. QNetworkManager receives a closed() signal and disconnects from the QNetworkSession.
  2. QNetworkManager receives a Connecting stateChanged() signal and sets itself to offline, but doesn't switch to another connection.
  3. QNetworkManager never receives any other signals from the now disconnected QNetworkSession, and so never changes state again and remains offline indefinitely.

The only way to get out of stage 3 is to go completely offline (e.g. turn off both Wifi and mobile data), because QNetworkManager also listens separately for offline/online signals. In contrast, disconnecting and reconnecting Wifi connections, or mobile data, without ever going fully offline, never gets out of state 3.

This change forces QNetworkManager to ignore Connecting stateChanged() signals if they occur when there is no active QNetworkSession, so that stage 2 never happens.

Edited Jul 01, 2019 by flypig

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch "https://git.sailfishos.org/flypig/qtbase.git" "jb46185-alternative"
git checkout -b "flypig/qtbase-jb46185-alternative" FETCH_HEAD

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/mer-5.6"
git merge --no-ff "flypig/qtbase-jb46185-alternative"

Step 4. Push the result of the merge to GitLab

git push origin "mer-5.6"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: mer-core/qtbase!48

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.