You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/03/06 14:59:52 UTC

(httpcomponents-core) branch master updated: HTTPCORE-777: Made I/O reactos cancel out incomplete connect request when shutting down

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 168149374 HTTPCORE-777: Made I/O reactos cancel out incomplete connect request when shutting down
168149374 is described below

commit 1681493747a5352bb9d47c62068d57092c940cfb
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Mar 6 13:37:40 2025 +0100

    HTTPCORE-777: Made I/O reactos cancel out incomplete connect request when shutting down
---
 .../org/apache/hc/core5/reactor/InternalConnectChannel.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
index e3dcabb8c..92c8b2a23 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
@@ -110,8 +110,14 @@ void onException(final Exception cause) {
 
     @Override
     public void close() throws IOException {
-        key.cancel();
-        socketChannel.close();
+        try {
+            if (!sessionRequest.isDone()) {
+                sessionRequest.cancel();
+            }
+        } finally {
+            key.cancel();
+            socketChannel.close();
+        }
     }
 
     @Override