summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java8
-rw-r--r--tunnel/src/main/java/com/wireguard/util/Resolver.java2
-rw-r--r--tunnel/tools/libwg-go/jni.c2
3 files changed, 7 insertions, 5 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
index 481ef8ae..23ea0e1e 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -323,10 +323,10 @@ public final class GoBackend implements Backend {
Log.w(TAG, "Wg user string: " + goConfig);
LibwgGrpc.LibwgBlockingStub stub = LibwgGrpc.newBlockingStub(channel);
- TunnelHandle handle = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build();
+ // TunnelHandle handle = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build();
// IpcSetRequest request = IpcSetRequest.newBuilder().setTunnel(handle).setConfig(goConfig).build();
// IpcSetResponse resp = stub.ipcSet(request);
- wgSetConfig(handle, request);
+ wgSetConfig(currentTunnelHandle, goConfig);
}
private static String downloadPacFile(Network network, Uri pacFileUrl) {
@@ -877,10 +877,10 @@ public final class GoBackend implements Backend {
Log.w(TAG, "is default network, config:" + goConfig);
LibwgGrpc.LibwgBlockingStub stub = LibwgGrpc.newBlockingStub(channel);
- TunnelHandle tunnel = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build();
+ // TunnelHandle tunnel = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build();
// IpcSetRequest request = IpcSetRequest.newBuilder().setTunnel(tunnel).setConfig(goConfig).build();
// IpcSetResponse resp = stub.ipcSet(request);
- wgSetConfig(handle, request);
+ wgSetConfig(currentTunnelHandle, goConfig);
}
}
}
diff --git a/tunnel/src/main/java/com/wireguard/util/Resolver.java b/tunnel/src/main/java/com/wireguard/util/Resolver.java
index 654e01f5..24f5ab88 100644
--- a/tunnel/src/main/java/com/wireguard/util/Resolver.java
+++ b/tunnel/src/main/java/com/wireguard/util/Resolver.java
@@ -111,6 +111,7 @@ public class Resolver {
if (sock.getLocalAddress().isAnyLocalAddress()) {
// Connect didn't find a local address.
Log.w(TAG, "No local address");
+ sock.close();
continue;
}
@@ -119,6 +120,7 @@ public class Resolver {
if (candidate instanceof Inet4Address) {
// Accept IPv4 as preferred address.
address = candidate;
+ sock.close();
break;
}
diff --git a/tunnel/tools/libwg-go/jni.c b/tunnel/tools/libwg-go/jni.c
index 7d6ee8a8..443848e8 100644
--- a/tunnel/tools/libwg-go/jni.c
+++ b/tunnel/tools/libwg-go/jni.c
@@ -73,7 +73,7 @@ JNIEXPORT jstring JNICALL Java_com_wireguard_android_backend_GoBackend_wgVersion
return ret;
}
-JNIEXPORT jint JNICALL Java_com_wireguard_android_backend_GoBackend_wgSetConfig(JNIEnv *env, jclass c, jstring handle, jstring settings)
+JNIEXPORT jint JNICALL Java_com_wireguard_android_backend_GoBackend_wgSetConfig(JNIEnv *env, jclass c, jint handle, jstring settings)
{
const char *settings_str = (*env)->GetStringUTFChars(env, settings, 0);
size_t settings_len = (*env)->GetStringUTFLength(env, settings);