-
Notifications
You must be signed in to change notification settings - Fork 896
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
VPN can't be reconnected in the same session when internet/wifi is disabled #13867
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,7 +312,6 @@ void BraveVpnService::CreateVPNConnection() { | |
return; | ||
} | ||
|
||
VLOG(2) << __func__; | ||
GetBraveVPNConnectionAPI()->CreateVPNConnection(GetConnectionInfo()); | ||
} | ||
|
||
|
@@ -324,10 +323,6 @@ void BraveVpnService::RemoveVPNConnnection() { | |
|
||
void BraveVpnService::Connect() { | ||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | ||
if (!IsNetworkAvailable()) { | ||
UpdateAndNotifyConnectionStateChange(ConnectionState::CONNECT_FAILED); | ||
return; | ||
} | ||
|
||
if (connection_state_ == ConnectionState::DISCONNECTING || | ||
connection_state_ == ConnectionState::CONNECTING) { | ||
|
@@ -349,6 +344,12 @@ void BraveVpnService::Connect() { | |
VLOG(2) << __func__ << " : start connecting!"; | ||
UpdateAndNotifyConnectionStateChange(ConnectionState::CONNECTING); | ||
|
||
if (!IsNetworkAvailable()) { | ||
VLOG(2) << __func__ << ": Network is not available, failed to connect"; | ||
UpdateAndNotifyConnectionStateChange(ConnectionState::CONNECT_FAILED); | ||
return; | ||
} | ||
|
||
if (is_simulation_ || connection_info_.IsValid()) { | ||
VLOG(2) << __func__ | ||
<< " : direct connect as we already have valid connection info."; | ||
|
@@ -900,7 +901,13 @@ void BraveVpnService::LoadPurchasedState() { | |
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | ||
if (GetPurchasedStateSync() == PurchasedState::LOADING) | ||
return; | ||
|
||
#if !BUILDFLAG(IS_ANDROID) | ||
if (!IsNetworkAvailable()) { | ||
VLOG(2) << __func__ << ": Network is not available, failed to connect"; | ||
UpdateAndNotifyConnectionStateChange(ConnectionState::CONNECT_FAILED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to notify this by monitoring network state instead of doing here. Is it possible? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we call this from typescript when open the panel and wait for long timeout |
||
return; | ||
} | ||
#endif | ||
if (!purchased_state_.has_value()) | ||
SetPurchasedState(PurchasedState::LOADING); | ||
|
||
|
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.
nit:
failed to check purchased state
?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.
keeping connect as discussed in Slack