Skip to content

Commit

Permalink
增加日志打印
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmiao committed Aug 30, 2019
1 parent 7c27b48 commit 484e4a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kcp-base/src/main/java/kcp/RecieveTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void execute() {
}
}
//判断写事件
if (kcp.canSend(false)&&!kcp.getSendList().isEmpty()) {
if (!kcp.getSendList().isEmpty()&&kcp.canSend(false)) {
kcp.notifyWriteEvent();
}
} catch (Throwable e) {
Expand Down
3 changes: 1 addition & 2 deletions kcp-base/src/main/java/kcp/ScheduleTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public void execute() {


//检测写缓冲区 如果能写则触发写事件
if(ukcp.canSend(false)
&&!ukcp.getSendList().isEmpty()
if(!ukcp.getSendList().isEmpty()&&ukcp.canSend(false)
){
ukcp.notifyWriteEvent();
}
Expand Down
9 changes: 8 additions & 1 deletion kcp-netty/src/main/java/test/KcpRttExampleClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,18 @@ public void handleClose(Ukcp kcp) {
}

int sum = 0;
int max = 0;
for (int rtt : rtts) {
if(rtt>max){
max = rtt;
}
sum += rtt;
}
System.out.println("average: "+ (sum / rtts.length));
System.out.println("average: "+ (sum / rtts.length)+" max:"+max);
System.out.println(Snmp.snmp.toString());
System.out.println("lost percent: "+(Snmp.snmp.RetransSegs.doubleValue()/Snmp.snmp.OutPkts.doubleValue()));


}


Expand Down

0 comments on commit 484e4a1

Please sign in to comment.