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/10/01 16:52:37 UTC

[httpcomponents-client] branch HTTPCLIENT-2236 updated (9e8d97c6b -> 9f4633977)

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

olegk pushed a change to branch HTTPCLIENT-2236
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


 discard 9e8d97c6b HTTPCLIENT-2236: MultihomeIOSessionRequester fails to enhance the cause exception in case of connect failure if the remoteAddress argument has been given
     add 956c00189 Temporarily removed windows-latest from the Github CI OS matrix due to intermittent network failures (java.io.IOException: An established connection was aborted by the software in your host machine). It is unclear whether this is a bug in the library or in the Windows JRE.
     new 9f4633977 HTTPCLIENT-2236: MultihomeIOSessionRequester fails to enhance the cause exception in case of connect failure if the remoteAddress argument has been given

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (9e8d97c6b)
            \
             N -- N -- N   refs/heads/HTTPCLIENT-2236 (9f4633977)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/maven.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


[httpcomponents-client] 01/01: HTTPCLIENT-2236: MultihomeIOSessionRequester fails to enhance the cause exception in case of connect failure if the remoteAddress argument has been given

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9f463397770aea978123dfdb4d0d59557031e27e
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Sep 30 16:34:51 2022 +0200

    HTTPCLIENT-2236: MultihomeIOSessionRequester fails to enhance the cause exception in case of connect failure if the remoteAddress argument has been given
---
 .../http/impl/nio/MultihomeIOSessionRequester.java | 33 ++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/MultihomeIOSessionRequester.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/MultihomeIOSessionRequester.java
index 4d90b8558..35e40726a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/MultihomeIOSessionRequester.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/MultihomeIOSessionRequester.java
@@ -66,18 +66,47 @@ final class MultihomeIOSessionRequester {
             final Object attachment,
             final FutureCallback<IOSession> callback) {
 
+        final ComplexFuture<IOSession> future = new ComplexFuture<>(callback);
         if (remoteAddress != null) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("{} connecting {} to {} ({})", remoteEndpoint, localAddress, remoteAddress, connectTimeout);
             }
-            return connectionInitiator.connect(remoteEndpoint, remoteAddress, localAddress, connectTimeout, attachment, callback);
+            final Future<IOSession> sessionFuture = connectionInitiator.connect(remoteEndpoint, remoteAddress, localAddress, connectTimeout, attachment, new FutureCallback<IOSession>() {
+                @Override
+                public void completed(final IOSession session) {
+                    future.completed(session);
+                }
+
+                @Override
+                public void failed(final Exception cause) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("{}:{} connection to {} failed ({}); terminating operation",
+                                remoteEndpoint.getHostName(), remoteEndpoint.getPort(), remoteAddress, cause.getClass());
+                    }
+                    if (cause instanceof IOException) {
+                        future.failed(ConnectExceptionSupport.enhance((IOException) cause, remoteEndpoint,
+                                (remoteAddress instanceof InetSocketAddress) ?
+                                        new InetAddress[] { ((InetSocketAddress) remoteAddress).getAddress() } :
+                                        new InetAddress[] {}));
+                    } else {
+                        future.failed(cause);
+                    }
+                }
+
+                @Override
+                public void cancelled() {
+                    future.cancel();
+                }
+
+            });
+            future.setDependency(sessionFuture);
+            return future;
         }
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("{} resolving remote address", remoteEndpoint);
         }
 
-        final ComplexFuture<IOSession> future = new ComplexFuture<>(callback);
         final InetAddress[] remoteAddresses;
         try {
             remoteAddresses = dnsResolver.resolve(remoteEndpoint.getHostName());