Skip to content

Commit

Permalink
如果session没有对应的connection不需要发送错误信息 #219
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Jan 3, 2024
1 parent cdecc1f commit 4671ba0
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ YieldableCommand getYieldableCommand(boolean checkTimeout) {
}

void sendError(int packetId, Throwable e) {
conn.sendError(session, packetId, e);
// 如果session没有对应的connection不需要发送错误信息
if (conn != null)
conn.sendError(session, packetId, e);
else
logger.error("", e);
}

@Override
Expand All @@ -150,9 +154,11 @@ public void onTimeout(YieldableCommand c, Throwable e) {

boolean isMarkClosed() {
if (session.isMarkClosed()) {
conn.closeSession(this);
if (conn.getSessionCount() == 0)
conn.close();
if (conn != null) {
conn.closeSession(this);
if (conn.getSessionCount() == 0)
conn.close();
}
return true;
}
return false;
Expand Down

0 comments on commit 4671ba0

Please sign in to comment.