From 9f7e7302a54f42acfb866b4de0e3eab200028b77 Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Thu, 25 Jul 2013 18:58:45 -0700 Subject: [PATCH] Ignore reading in closing socket --- .../mcprotocol/standard/StandardConnection.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java index 43714bc1..e44e38b2 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java @@ -56,11 +56,6 @@ public abstract class StandardConnection extends BaseConnection { */ private Queue packets = new ConcurrentLinkedQueue(); - /** - * Whether the connection is reading. - */ - private boolean reading = false; - /** * Whether the connection is writing. */ @@ -170,7 +165,6 @@ public abstract class StandardConnection extends BaseConnection { public void run() { while(isConnected()) { try { - reading = true; int opcode = input.readUnsignedByte(); if(opcode < 0) { continue; @@ -190,8 +184,6 @@ public abstract class StandardConnection extends BaseConnection { } else if(StandardConnection.this instanceof ServerConnection) { packet.handleServer((ServerConnection) StandardConnection.this); } - - reading = false; } catch(EOFException e) { disconnect("End of Stream"); } catch (Exception e) { @@ -204,8 +196,6 @@ public abstract class StandardConnection extends BaseConnection { Thread.sleep(2); } catch (InterruptedException e) { } - - reading = false; } } } @@ -246,12 +236,12 @@ public abstract class StandardConnection extends BaseConnection { } /** - * A thread that waits for the connection to finish before closing it. + * A thread that waits for the connection to finish writing before closing it. */ private class CloseThread extends Thread { @Override public void run() { - while(reading || writing) { + while(writing) { try { Thread.sleep(2); } catch (InterruptedException e) {