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
Stop synchronisation when behind a captive portal #11567
base: master
Are you sure you want to change the base?
Conversation
The |
2728dbe
to
7dd72f4
Compare
if (onoff) { | ||
_queueGuard.block(); | ||
} else { | ||
// TODO: empty queue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It might depend on how long we were blocked, 10s or 20h...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure what to do with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets clear it.
if (_account->accessManager()->isBehindCaptivePortal()) { | ||
_queueGuard.block(); | ||
} else { | ||
// TODO: empty queue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this unblock has any use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we be blocked during the construction of the class?
src/gui/accountstate.cpp
Outdated
@@ -247,6 +263,7 @@ void AccountState::setState(State state) | |||
} else if (_state == Connected && Utility::internetConnectionIsMetered() && ConfigFile().pauseSyncWhenMetered()) { | |||
_state = PausedDueToMetered; | |||
} | |||
// Do we need an extra state PausedDueToCaptivePortal? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we could reuse "Connecting"? In the end its only to display a different string? In which case we could make the "connecting" message conditional on isBehindCaptivePortal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a manual testing action, it has quite a heavy impact on the client...
Brainstorming: We have multiple network information things to test, could it make sense to implement a custom one that wraps the native one and allows overriding values? |
7dd72f4
to
f10d5eb
Compare
03c2325
to
4e85060
Compare
Please rebase, once done I can start a review. |
5b1e182
to
412851f
Compare
connect(NetworkInformation::instance(), &NetworkInformation::isBehindCaptivePortalChanged, this, [this](bool) { | ||
// A direct connect is not possible, because then the state parameter of `isBehindCaptivePortalChanged` | ||
// would become the `verifyServerState` argument to `checkConnectivity`. | ||
QTimer::singleShot(0, this, [this] { checkConnectivity(false); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to run the check if it changed to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it sets the state to Connecting
and triggers the signals so the UI shows paused and captive portal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add that as a comment? I see the possibility that someone might "Optimize" that call.
412851f
to
07efac2
Compare
07efac2
to
8920af8
Compare
8920af8
to
fdde86d
Compare
@@ -27,6 +28,8 @@ namespace OCC { | |||
namespace TestUtils { | |||
TestUtilsPrivate::AccountStateRaii createDummyAccount() | |||
{ | |||
// ensure we have an instance of NetworkInformation | |||
NetworkInformation::initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move that to https://github.com/owncloud/client/blob/master/test/testutils/testutilsloader.cpp#L9
|
||
NetworkInformation *NetworkInformation::_instance = nullptr; | ||
|
||
static void loadQNetworkInformationBackend() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anonymous namespace please
} | ||
|
||
void NetworkInformation::initialize() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the explicit initialize call or could it make sense to merge it with the instance call?
if (onoff) { | ||
_queueGuard.block(); | ||
} else { | ||
// TODO: empty queue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets clear it.
if (_account->accessManager()->isBehindCaptivePortal()) { | ||
_queueGuard.block(); | ||
} else { | ||
// TODO: empty queue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we be blocked during the construction of the class?
Like we do for when the client is behind a captive portal.
fdde86d
to
e6a9593
Compare
Fixes: #11533