Skip to content

Commit 484e4a1

Browse files
author
jinmiao
committed
增加日志打印
1 parent 7c27b48 commit 484e4a1

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

kcp-base/src/main/java/kcp/RecieveTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void execute() {
7979
}
8080
}
8181
//判断写事件
82-
if (kcp.canSend(false)&&!kcp.getSendList().isEmpty()) {
82+
if (!kcp.getSendList().isEmpty()&&kcp.canSend(false)) {
8383
kcp.notifyWriteEvent();
8484
}
8585
} catch (Throwable e) {

kcp-base/src/main/java/kcp/ScheduleTask.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public void execute() {
6464

6565

6666
//检测写缓冲区 如果能写则触发写事件
67-
if(ukcp.canSend(false)
68-
&&!ukcp.getSendList().isEmpty()
67+
if(!ukcp.getSendList().isEmpty()&&ukcp.canSend(false)
6968
){
7069
ukcp.notifyWriteEvent();
7170
}

kcp-netty/src/main/java/test/KcpRttExampleClient.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,18 @@ public void handleClose(Ukcp kcp) {
133133
}
134134

135135
int sum = 0;
136+
int max = 0;
136137
for (int rtt : rtts) {
138+
if(rtt>max){
139+
max = rtt;
140+
}
137141
sum += rtt;
138142
}
139-
System.out.println("average: "+ (sum / rtts.length));
143+
System.out.println("average: "+ (sum / rtts.length)+" max:"+max);
140144
System.out.println(Snmp.snmp.toString());
145+
System.out.println("lost percent: "+(Snmp.snmp.RetransSegs.doubleValue()/Snmp.snmp.OutPkts.doubleValue()));
146+
147+
141148
}
142149

143150

0 commit comments

Comments
 (0)