Skip to content

Commit

Permalink
fix(engine): expose session close (#852)
Browse files Browse the repository at this point in the history
Fixes ooni/probe#2810

## Proposed Changes

  - Exposes the `close` function for the engine session 
- Invokes the `close` function while downloading urls for
webconnectivity to ensure the running psiphon tunnel (and engine
session) is closed before the experiment run
- Changes in engine api surface:
ooni/probe-cli#1657
  • Loading branch information
DecFox authored Nov 29, 2024
1 parent 0460922 commit 8a98099
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ private void downloadURLs() {
currentTest.setMax_runtime(app.getPreferenceManager().getMaxRuntime());
}
publishProgress(URL);

// we close the session to ensure that we have no running circumvention tunnels
session.close();
} catch (Exception e) {
e.printStackTrace();
ThirdPartyServices.logException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ public interface OONISession {
OONIRunDescriptor getLatestOONIRunLink(OONIContext ctx, String probeServicesURL, long id) throws Exception;

OONIRunRevisions getOONIRunLinkRevisions(@Nullable OONIContext ooniContext, @NotNull String probeServicesURL, long runId) throws Exception ;

/** close closes the session along with any running circumvention tunnels */
void close() throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ public OONIRunRevisions getOONIRunLinkRevisions(OONIContext ooniContext, @NotNul

return revisions;
}

public void close() throws Exception {
session.close();
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ markwon = "4.6.2"
shapeofview = "1.4.7"
targetSdk = "35"
minSdk = "21"
oonimkall = "2024.08.08-091959"
oonimkall = "2024.11.26-053000"

junit = "4.13.2"
dbflow = "4.2.4"
Expand Down

0 comments on commit 8a98099

Please sign in to comment.