File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
kcp-base/src/main/java/kcp
kcp-netty/src/main/java/test Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments