diff --git a/src/main/java/chokistream/ChirunoModClient.java b/src/main/java/chokistream/ChirunoModClient.java index ffccfde..ff90a89 100644 --- a/src/main/java/chokistream/ChirunoModClient.java +++ b/src/main/java/chokistream/ChirunoModClient.java @@ -133,21 +133,7 @@ public void sendInit() throws IOException { public void sendDisconnect() throws IOException { logger.log("Sending disconnect packet", LogLevel.VERBOSE); - try { - out.write((new Packet((byte)0x03, (byte)0x00, new byte[] {})).pack); - } catch (SocketException e) { - /** - * Refer to docs. - * https://github.com/Eiim/Chokistream/wiki/Technical-info-on-bugs-and-quirks/_edit#issues-with-luma3ds-control-wireless-connection-hack - * todo: investigate */ - if(e.getMessage().contains("Broken pipe")) { - // do something? - } - - logger.log("ChirunoModClient.sendDisconnect() warning: "+e.getClass()+": "+e.getMessage()); - logger.log(Arrays.toString(e.getStackTrace()), LogLevel.VERBOSE); - logger.log("The 3DS seems to have already disconnected"); - } + out.write((new Packet((byte)0x03, (byte)0x00, new byte[] {})).pack); } // We don't really have a use for this yet but might as well support it @@ -221,7 +207,21 @@ public void switchScreen() throws IOException { @Override public void close() throws IOException { - sendDisconnect(); + try { + sendDisconnect(); + } catch (SocketException e) { + if(e.getMessage().contains("Broken pipe")) { + /* + * Documented here: https://github.com/Eiim/Chokistream/wiki/Technical-info-on-bugs-and-quirks/_edit#issues-with-luma3ds-control-wireless-connection-hack + * TODO: investigate, possibly handle more cleanly or fix + */ + logger.log("ChirunoModClient.close() warning: "+e.getClass()+": "+e.getMessage()); + logger.log(Arrays.toString(e.getStackTrace()), LogLevel.VERBOSE); + logger.log("The 3DS seems to have already disconnected"); + } else { + throw e; + } + } in.close(); out.close(); client.close();