From 98be9584f2627289dabc6f7d51db69179a973b98 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Mon, 4 Jul 2022 02:58:39 -0300 Subject: Last minute quick fixes --- src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/ganarchy/friendcode/sam') diff --git a/src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java b/src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java index d05717d..1c55bc6 100644 --- a/src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java +++ b/src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java @@ -41,10 +41,10 @@ public abstract class I2PSamStateMachine implements Closeable { public abstract boolean connect(); protected boolean connect(Socket samSocket) { - this.samSocket = samSocket; if (this.connected) { throw new IllegalStateException(); } + this.samSocket = samSocket; this.connected = true; return true; } @@ -207,7 +207,9 @@ public abstract class I2PSamStateMachine implements Closeable { * @throws IOException As per {@link Socket#close()}. */ public void close() throws IOException { - this.samSocket.close(); + if (this.connected) { + this.samSocket.close(); + } } protected Socket unwrap() { -- cgit 1.4.1