diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-10-23 00:07:00 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-10-23 00:07:53 +0200 |
commit | 802890c656b749fa5bd6f64e2c9c7b13890008ea (patch) | |
tree | 6136f21e9592c87f6ed9ff4d3c19da74cd9f80dd | |
parent | e43facb660e62380c0f317d510e4fdc5b5648b6a (diff) |
WIP: handle StatusRuntimeException
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 16 |
1 files changed, 13 insertions, 3 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 120038a3..d5ec45a7 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -65,6 +65,7 @@ import com.wireguard.util.Resolver; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; +import io.grpc.StatusRuntimeException; import io.grpc.android.UdsChannelBuilder; import io.grpc.okhttp.OkHttpChannelBuilder; import io.grpc.stub.StreamObserver; @@ -375,8 +376,12 @@ public final class GoBackend implements Backend { reqBuilder.addCapabilities(CapabilitiesChangedRequest.Capability.NOT_METERED); } - CapabilitiesChangedResponse resp = stub.capabilitiesChanged(reqBuilder.build()); - Log.i(TAG, "Capabilities change: " + resp.getError().getMessage()); + try { + CapabilitiesChangedResponse resp = stub.capabilitiesChanged(reqBuilder.build()); + Log.i(TAG, "Capabilities change: " + resp.getError().getMessage()); + } catch(StatusRuntimeException e) { + Log.i(TAG, "Capabilities change exception: " + e); + } } private int startHttpProxy(String pacFile) { @@ -985,7 +990,12 @@ public final class GoBackend implements Backend { LibwgGrpc.LibwgBlockingStub stub = LibwgGrpc.newBlockingStub(channel); TunnelHandle tunnel = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build(); IpcSetRequest request = IpcSetRequest.newBuilder().setTunnel(tunnel).setConfig(goConfig).build(); - IpcSetResponse resp = stub.ipcSet(request); + + try { + IpcSetResponse resp = stub.ipcSet(request); + } catch(StatusRuntimeException e) { + Log.e(TAG, "ipcSet exception: " + e); + } for (final Peer peer : currentConfig.getPeers()) { final InetEndpoint ep = peer.getEndpoint().orElse(null); |