Skip to content

Commit

Permalink
Bug fix: Correct the issue with connection state detection in Default…
Browse files Browse the repository at this point in the history
…ManagedAsyncClientConnection#isOpen().
  • Loading branch information
yhzdys authored and ok2c committed Oct 17, 2024
1 parent d68f8b0 commit b45e981
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,20 @@ public void close() throws IOException {

@Override
public boolean isOpen() {
return ioSession.isOpen();
final IOSession ioSession = this.ioSession;
if (ioSession.isOpen()) {
final IOEventHandler handler = ioSession.getHandler();
if (handler instanceof HttpConnection) {
final HttpConnection conn = (HttpConnection) handler;
final ProtocolVersion protocolVersion = conn.getProtocolVersion();
if (protocolVersion != null && protocolVersion.greaterEquals(HttpVersion.HTTP_2)) {
return conn.isOpen();
}
}
return true;
} else {
return false;
}
}

@Override
Expand Down

0 comments on commit b45e981

Please sign in to comment.