diff --git a/README.md b/README.md index 2be57e9..a9cc405 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ To add a dependency using Maven: io.jpower.kcp kcp-netty - 1.4.11 + 1.4.12 ``` diff --git a/kcp-example/pom.xml b/kcp-example/pom.xml index 877e1af..43110c4 100755 --- a/kcp-example/pom.xml +++ b/kcp-example/pom.xml @@ -5,7 +5,7 @@ io.jpower.kcp kcp-parent - 1.4.11 + 1.4.12 4.0.0 diff --git a/kcp-netty/pom.xml b/kcp-netty/pom.xml index 08fc481..3b673d0 100755 --- a/kcp-netty/pom.xml +++ b/kcp-netty/pom.xml @@ -5,7 +5,7 @@ io.jpower.kcp kcp-parent - 1.4.11 + 1.4.12 4.0.0 diff --git a/kcp-netty/src/main/java/io/jpower/kcp/netty/Kcp.java b/kcp-netty/src/main/java/io/jpower/kcp/netty/Kcp.java index fac9d84..46c606b 100755 --- a/kcp-netty/src/main/java/io/jpower/kcp/netty/Kcp.java +++ b/kcp-netty/src/main/java/io/jpower/kcp/netty/Kcp.java @@ -331,6 +331,7 @@ private void release(List segQueue) { for (Segment seg : segQueue) { seg.recycle(true); } + segQueue.clear(); } private ByteBuf tryCreateOrOutput(ByteBuf buffer, int need) { diff --git a/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientChannel.java b/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientChannel.java index 2e27581..99db930 100644 --- a/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientChannel.java +++ b/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientChannel.java @@ -222,6 +222,10 @@ public UkcpClientChannel conv(int conv) { return this; } + public boolean kcpIsActive() { + return ukcp.isActive(); + } + void kcpReceive(ByteBuf buf) throws IOException { ukcp.receive(buf); } diff --git a/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientUdpChannel.java b/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientUdpChannel.java index 22c4c34..f10cc5e 100644 --- a/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientUdpChannel.java +++ b/kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientUdpChannel.java @@ -295,7 +295,7 @@ public void read() { exception1 = t; } - if (exception1 == null) { + if (exception1 == null && ukcpChannel.kcpIsActive()) { boolean mergeSegmentBuf = ukcpChannel.config().isMergeSegmentBuf(); CodecOutputList recvBufList = null; boolean recv = false; diff --git a/pom.xml b/pom.xml index 7c0653c..fffc1c6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.jpower.kcp kcp-parent - 1.4.11 + 1.4.12 pom kcp-netty [Parent]