🐛 Don’t force disconnection on protocol errors
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 29 Feb 2020 11:58:06 +0000 (12:58 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 29 Feb 2020 11:58:06 +0000 (12:58 +0100)
src/main/java/net/pterodactylus/fcp/highlevel/FcpClient.java

index 6d51c92..e171678 100644 (file)
@@ -1261,7 +1261,10 @@ public class FcpClient implements Closeable {
                                fcpConnection.removeFcpListener(this);
                        }
                        if (fcpException != null) {
-                               setDisconnected();
+                               // FORGIVE ME: this should be a property of the exception, “close connection after this”
+                               if (!(fcpException instanceof FcpProtocolException)) {
+                                       setDisconnected();
+                               }
                                throw fcpException;
                        }
                }