Bug fix: Correct the issue with connection state detection in DefaultManagedAsyncClientConnection#isOpen().

This commit is contained in:
yhzdys 2024-10-16 15:13:03 +08:00 committed by Oleg Kalnichevski
parent d68f8b068a
commit b45e9818cc
1 changed files with 14 additions and 1 deletions

View File

@ -98,7 +98,20 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
@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