Skip to content

Commit

Permalink
修复 当所有会话监听器都执行完成后,再将会话状态置为已关闭
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeFJ committed Sep 28, 2023
1 parent 3c6987b commit 3e3b967
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/jfeng/gateway/session/TcpSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,14 @@ public void close(String closeReason) {
MDC.remove(Constant.LOG_ADDRESS);
MDC.remove(Constant.LOG_TRANSACTION_ID);

if (this.histroyRecordFIFO != null) {
this.histroyRecordFIFO.clear();
}
sessionListeners.stream().forEach(x -> x.onDisConnect(this, closeReason));

this.sessionStatus = SessionStatus.CLOSED;
this.closeReason = closeReason;
this.channel.attr(SESSION_KEY).getAndSet(null);
if (this.channel != null) {
channel.close();
}
sessionListeners.stream().forEach(x -> x.onDisConnect(this, closeReason));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void onSend(TcpSession tcpSession, byte[] data) {

@Override
public void onDisConnect(TcpSession tcpSession, String reason) {

tcpSession.getHistroyRecordFIFO().clear();
}

@Override
Expand Down

0 comments on commit 3e3b967

Please sign in to comment.