Skip to content

Commit 666d22b

Browse files
committed
Add protection against issues with socket
1 parent b65f0bc commit 666d22b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

android/lib/talpid/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt

+7-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ class ConnectivityListener(
5151
hasInternetCapability: Boolean ->
5252
if (hasInternetCapability) {
5353
ConnectionStatus(
54-
IPAvailabilityUtils.isIPv4Available(protect = { protect(it) }),
55-
IPAvailabilityUtils.isIPv6Available(protect = { protect(it) }),
56-
)
54+
IPAvailabilityUtils.isIPv4Available(protect = { protect(it) }),
55+
IPAvailabilityUtils.isIPv6Available(protect = { protect(it) }),
56+
)
57+
// If we have internet, but both IPv4 and IPv6 are not available, we
58+
// assume something is wrong and instead
59+
// will return both as available since this is the previous behavior.
60+
.takeUnless { !it.ipv4 && !it.ipv6 } ?: ConnectionStatus(true, true)
5761
} else {
5862
ConnectionStatus(false, false)
5963
}

0 commit comments

Comments
 (0)