From 32352ad6726394c0f8fd9a5df9bd0f75d4490fa8 Mon Sep 17 00:00:00 2001 From: PandaNinjas Date: Thu, 9 Feb 2023 20:04:19 -0800 Subject: Code things idk --- .../malwarefight/nosession/mixin/client/YggdrasilSessionMixin.java | 6 +++++- src/main/java/gq/malwarefight/tokenapp/Main.java | 3 ++- src/main/java/gq/malwarefight/tokenapp/SocketThread.java | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/gq/malwarefight/nosession/mixin/client/YggdrasilSessionMixin.java b/src/main/java/gq/malwarefight/nosession/mixin/client/YggdrasilSessionMixin.java index 25636f7..ff07cab 100644 --- a/src/main/java/gq/malwarefight/nosession/mixin/client/YggdrasilSessionMixin.java +++ b/src/main/java/gq/malwarefight/nosession/mixin/client/YggdrasilSessionMixin.java @@ -43,7 +43,11 @@ public class YggdrasilSessionMixin { try { socket.getOutputStream().write("disconnect\n".getBytes(StandardCharsets.UTF_8)); socket.close(); - } catch (IOException ignored) {} + } catch (IOException ignored) { + // it doesn't matter if the socket is disconnected + // if there's an IOException, the socket is either closed or + // impossible to close/unusable + } } } } \ No newline at end of file diff --git a/src/main/java/gq/malwarefight/tokenapp/Main.java b/src/main/java/gq/malwarefight/tokenapp/Main.java index 96b9cb3..f86711b 100644 --- a/src/main/java/gq/malwarefight/tokenapp/Main.java +++ b/src/main/java/gq/malwarefight/tokenapp/Main.java @@ -53,6 +53,7 @@ public class Main { sock = new ServerSocket(i, 50, InetAddress.getLoopbackAddress()); break; } catch (Exception ignored) { + // we couldn't bind to the port, try the next one } } if (sock == null) { @@ -64,7 +65,7 @@ public class Main { Socket connection = sock.accept(); Thread t = new SocketThread(connection); t.start(); - } catch (IOException ignored) { + } catch (IOException exception) { System.exit(0); } } diff --git a/src/main/java/gq/malwarefight/tokenapp/SocketThread.java b/src/main/java/gq/malwarefight/tokenapp/SocketThread.java index f2d0be7..e0f69dc 100644 --- a/src/main/java/gq/malwarefight/tokenapp/SocketThread.java +++ b/src/main/java/gq/malwarefight/tokenapp/SocketThread.java @@ -57,6 +57,8 @@ public class SocketThread extends Thread { } } - } catch (IOException ignored) {} + } catch (IOException ignored) { + // if something goes wrong, don't worry! just quit immediately + } } } -- cgit