Skip to content

Commit 714155a

Browse files
committed
HTTPCORE-777: Made I/O reactos cancel out incomplete connect request when shutting down
1 parent 5aad6bb commit 714155a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ void onException(final Exception cause) {
110110

111111
@Override
112112
public void close() throws IOException {
113-
key.cancel();
114-
socketChannel.close();
113+
try {
114+
if (!sessionRequest.isDone()) {
115+
sessionRequest.cancel();
116+
}
117+
} finally {
118+
key.cancel();
119+
socketChannel.close();
120+
}
115121
}
116122

117123
@Override

0 commit comments

Comments
 (0)