summary refs log tree commit diff stats
path: root/src/main/java/ganarchy/friendcode/sam
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-07-04 02:58:39 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-07-04 02:58:39 -0300
commit98be9584f2627289dabc6f7d51db69179a973b98 (patch)
tree7f71b73ca45c34605838151d3b02f6682232308b /src/main/java/ganarchy/friendcode/sam
parent901941591749dc97afe1900b1d7b0d24da6e28d4 (diff)
Last minute quick fixes
Diffstat (limited to 'src/main/java/ganarchy/friendcode/sam')
-rw-r--r--src/main/java/ganarchy/friendcode/sam/I2PSamStateMachine.java6
1 files changed, 4 insertions, 2 deletions
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() {