Skip to content

Commit

Permalink
Fix WaitForNetworkConnectivity additional condition
Browse files Browse the repository at this point in the history
additionalConditionChecker was not included in the initial, pre-wait loop check,
causing that condition to be skipped. Impacted IsInproxyCompatibleNetworkType
in inproxyWaitForNetworkConnectivity.
  • Loading branch information
rod-hynes committed Nov 1, 2024
1 parent 017bd61 commit d0cb905
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions psiphon/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ func WaitForNetworkConnectivity(
connectivityChecker NetworkConnectivityChecker,
additionalConditionChecker func() bool) bool {

if connectivityChecker == nil || connectivityChecker.HasNetworkConnectivity() == 1 {
if (connectivityChecker == nil || connectivityChecker.HasNetworkConnectivity() == 1) &&
(additionalConditionChecker == nil || additionalConditionChecker()) {
return true
}

Expand All @@ -313,7 +314,7 @@ func WaitForNetworkConnectivity(
defer ticker.Stop()

for {
if connectivityChecker.HasNetworkConnectivity() == 1 &&
if (connectivityChecker == nil || connectivityChecker.HasNetworkConnectivity() == 1) &&
(additionalConditionChecker == nil || additionalConditionChecker()) {
return true
}
Expand Down

0 comments on commit d0cb905

Please sign in to comment.