Skip to content

Commit

Permalink
Ignore SocketException
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Oct 12, 2021
1 parent 8e95115 commit 1be1912
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rirud/src/main/java/riru/DaemonSocketServerThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1be1912

Please sign in to comment.