Skip to content

Commit

Permalink
Merge branch 'master' into staging-client
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-hynes committed Nov 4, 2020
2 parents 1f16f50 + c5c94f3 commit 45558fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions MobileLibrary/Android/PsiphonTunnel/PsiphonTunnel.java
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,6 @@ private static String buildPsiphonConfig(Context context, HostLogger logger, Str
File oslDownloadDir = new File(context.getFilesDir(), "osl");
json.put("MigrateObfuscatedServerListDownloadDirectory", oslDownloadDir.getAbsolutePath());

// Note: onConnecting/onConnected logic assumes 1 tunnel connection
json.put("TunnelPoolSize", 1);

// Continue to run indefinitely until connected
if (!json.has("EstablishTunnelTimeoutSeconds")) {
json.put("EstablishTunnelTimeoutSeconds", 0);
Expand Down Expand Up @@ -911,14 +908,15 @@ private void handlePsiphonNotice(String noticeJSON) {

if (noticeType.equals("Tunnels")) {
int count = notice.getJSONObject("data").getInt("count");
if (count > 0) {
if (count == 0) {
mHostService.onConnecting();
} else if (count == 1) {
if (isVpnMode() && mShouldRouteThroughTunnelAutomatically) {
routeThroughTunnel();
}
mHostService.onConnected();
} else {
mHostService.onConnecting();
}
// count > 1 is an additional multi-tunnel establishment, and not reported.

} else if (noticeType.equals("AvailableEgressRegions")) {
JSONArray egressRegions = notice.getJSONObject("data").getJSONArray("regions");
Expand Down
10 changes: 4 additions & 6 deletions MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,6 @@ + (NSString * _Nullable)buildPsiphonConfig:(id _Nonnull)configObject

config[@"DeviceRegion"] = [PsiphonTunnel getDeviceRegion];

// This library expects a pool size of 1
config[@"TunnelPoolSize"] = [NSNumber numberWithInt:1];

// We don't support upgrade downloading
config[@"UpgradeDownloadURLs"] = nil;
config[@"UpgradeDownloadUrl"] = nil;
Expand Down Expand Up @@ -899,11 +896,12 @@ - (void)handlePsiphonNotice:(NSString * _Nonnull)noticeJSON {
return;
}

if ([count integerValue] > 0) {
[self changeConnectionStateTo:PsiphonConnectionStateConnected evenIfSameState:NO];
} else {
if ([count integerValue] == 0) {
[self changeConnectionStateTo:PsiphonConnectionStateConnecting evenIfSameState:NO];
} else if ([count integerValue] == 1) {
[self changeConnectionStateTo:PsiphonConnectionStateConnected evenIfSameState:NO];
}
// count > 1 is an additional multi-tunnel establishment, and not reported.
}
else if ([noticeType isEqualToString:@"Exiting"]) {
if ([self.tunneledAppDelegate respondsToSelector:@selector(onExiting)]) {
Expand Down

0 comments on commit 45558fd

Please sign in to comment.