Skip to content

Commit ac250d8

Browse files
committed
Improved code
1 parent ed6addc commit ac250d8

File tree

7 files changed

+10
-5
lines changed

7 files changed

+10
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To add a dependency using Maven:
99
<dependency>
1010
<groupId>io.jpower.kcp</groupId>
1111
<artifactId>kcp-netty</artifactId>
12-
<version>1.4.11</version>
12+
<version>1.4.12</version>
1313
</dependency>
1414
```
1515

kcp-example/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.jpower.kcp</groupId>
77
<artifactId>kcp-parent</artifactId>
8-
<version>1.4.11</version>
8+
<version>1.4.12</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kcp-netty/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.jpower.kcp</groupId>
77
<artifactId>kcp-parent</artifactId>
8-
<version>1.4.11</version>
8+
<version>1.4.12</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kcp-netty/src/main/java/io/jpower/kcp/netty/Kcp.java

+1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ private void release(List<Segment> segQueue) {
331331
for (Segment seg : segQueue) {
332332
seg.recycle(true);
333333
}
334+
segQueue.clear();
334335
}
335336

336337
private ByteBuf tryCreateOrOutput(ByteBuf buffer, int need) {

kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientChannel.java

+4
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ public UkcpClientChannel conv(int conv) {
222222
return this;
223223
}
224224

225+
public boolean kcpIsActive() {
226+
return ukcp.isActive();
227+
}
228+
225229
void kcpReceive(ByteBuf buf) throws IOException {
226230
ukcp.receive(buf);
227231
}

kcp-netty/src/main/java/io/jpower/kcp/netty/UkcpClientUdpChannel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void read() {
295295
exception1 = t;
296296
}
297297

298-
if (exception1 == null) {
298+
if (exception1 == null && ukcpChannel.kcpIsActive()) {
299299
boolean mergeSegmentBuf = ukcpChannel.config().isMergeSegmentBuf();
300300
CodecOutputList<ByteBuf> recvBufList = null;
301301
boolean recv = false;

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.jpower.kcp</groupId>
88
<artifactId>kcp-parent</artifactId>
9-
<version>1.4.11</version>
9+
<version>1.4.12</version>
1010
<packaging>pom</packaging>
1111

1212
<name>kcp-netty [Parent]</name>

0 commit comments

Comments
 (0)