From 86c694f8f852821b72ca136f26c0b37713f857fd Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Wed, 13 Jun 2018 23:47:36 +0200 Subject: [PATCH] small async packetsending change --- src/main/protocol/HConnection.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/protocol/HConnection.java b/src/main/protocol/HConnection.java index 31c2b57..a116054 100644 --- a/src/main/protocol/HConnection.java +++ b/src/main/protocol/HConnection.java @@ -25,15 +25,13 @@ public class HConnection { public HConnection() { new Thread(() -> { while (true) { - if (inHandler != null) { - HPacket packet; - while ((packet = sendToClientAsyncQueue.poll()) != null) { - sendToClient(packet); - } + HPacket packet; + while ((packet = sendToClientAsyncQueue.poll()) != null) { + sendToClient(packet); } try { Thread.sleep(1); - } catch (InterruptedException e) { + } catch (InterruptedException e) { //java........................................ e.printStackTrace(); } } @@ -41,11 +39,9 @@ public class HConnection { new Thread(() -> { while (true) { - if (outHandler != null) { - HPacket packet; - while ((packet = sendToServerAsyncQueue.poll()) != null) { - sendToServer(packet); - } + HPacket packet; + while ((packet = sendToServerAsyncQueue.poll()) != null) { + sendToServer(packet); } try { Thread.sleep(1);