From 1be1912e0e154563e4a75751f3a989864876823e Mon Sep 17 00:00:00 2001 From: LoveSy Date: Wed, 13 Oct 2021 01:24:39 +0800 Subject: [PATCH] Ignore SocketException --- rirud/src/main/java/riru/DaemonSocketServerThread.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rirud/src/main/java/riru/DaemonSocketServerThread.java b/rirud/src/main/java/riru/DaemonSocketServerThread.java index d590c0b5..736263e3 100644 --- a/rirud/src/main/java/riru/DaemonSocketServerThread.java +++ b/rirud/src/main/java/riru/DaemonSocketServerThread.java @@ -20,6 +20,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.SocketException; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; @@ -349,6 +350,7 @@ private void startServer() throws IOException { socket = serverSocket.accept(); } catch (IOException e) { if ((e.getCause() != null && e.getCause() instanceof ErrnoException && ((ErrnoException) e.getCause()).errno == EINVAL) || + e instanceof SocketException || (e.getMessage() != null && (e.getMessage().contains("EINVAL") || e.getMessage().contains(String.format(Locale.ROOT, "errno %d", EINVAL))))) { Log.i(TAG, "Server shutdown."); return;