Skip to content

Commit 06f26ad

Browse files
committed
optimize network
1 parent 47c176c commit 06f26ad

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CarzyCarServer/src/main/java/com/tastsong/crazycar/controller/MatchRoomKCPController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ public void handleException(Throwable ex, Ukcp kcp) {
275275
public void handleClose(Ukcp uKcp) {
276276
log.info("handleClose " + Snmp.snmp.toString());
277277
Snmp.snmp = new Snmp();
278+
exitRoom();
278279
log.info("onClose");
279280
}
280281

@@ -293,6 +294,7 @@ private void exitRoom(){
293294
log.info("onClose : " + MatchRoomKCPController.roomMap.size());
294295
}
295296
kcpSet.remove(id);
297+
id = "";
296298
onlineCount--; // 在线数减1
297299
log.info("onclose sum = " + onlineCount);
298300
}

CarzyCarServer/src/main/java/com/tastsong/crazycar/controller/MatchRoomWebSocket.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public void onClose() {
7272
log.info("onClose : " + MatchRoomWebSocket.roomMap.size());
7373
}
7474
webSocketSet.remove(id);
75+
id = "";
7576
subOnlineCount();
7677
log.info("Match Room onClose, num = " + getOnlineCount());
7778
}

0 commit comments

Comments
 (0)