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 2022/05/05 08:47:10 UTC
[httpcomponents-client] branch 5.1.x updated: HTTPCLIENT-2212: MinimalHttpAsyncClient fails to release client endpoints in case of a connect error (such as TLS handshake failure)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
The following commit(s) were added to refs/heads/5.1.x by this push:
new b7a1d600a HTTPCLIENT-2212: MinimalHttpAsyncClient fails to release client endpoints in case of a connect error (such as TLS handshake failure)
b7a1d600a is described below
commit b7a1d600a1449d1d931101e4ecc8de57b4ea188a
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed May 4 21:13:52 2022 +0200
HTTPCLIENT-2212: MinimalHttpAsyncClient fails to release client endpoints in case of a connect error (such as TLS handshake failure)
---
.../hc/client5/http/impl/async/MinimalHttpAsyncClient.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index c763899fe..9ffb632c4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -174,12 +174,22 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void failed(final Exception ex) {
- resultFuture.failed(ex);
+ try {
+ Closer.closeQuietly(connectionEndpoint);
+ manager.release(connectionEndpoint, null, TimeValue.ZERO_MILLISECONDS);
+ } finally {
+ resultFuture.failed(ex);
+ }
}
@Override
public void cancelled() {
- resultFuture.cancel(true);
+ try {
+ Closer.closeQuietly(connectionEndpoint);
+ manager.release(connectionEndpoint, null, TimeValue.ZERO_MILLISECONDS);
+ } finally {
+ resultFuture.cancel(true);
+ }
}
});