From: Fabian Keil <fk@fabiankeil.de>
Date: Tue, 3 May 2011 10:11:24 +0000 (+0000)
Subject: In rfc2553_connect_to(), prevent a duplicated log message if none of the resolved... 
X-Git-Tag: v_3_0_18~246
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/@default-cgi@/static/@default-cgi@show-status?a=commitdiff_plain;h=ae286185f6afeafd979ae30bbdae9f4afe378bd3;p=privoxy.git

In rfc2553_connect_to(), prevent a duplicated log message if none of the resolved IP addresses were connectable
---

diff --git a/jbsockets.c b/jbsockets.c
index 8d14cdf6..5691988d 100644
--- a/jbsockets.c
+++ b/jbsockets.c
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.100 2011/04/27 18:11:05 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.101 2011/05/03 09:55:35 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -350,8 +350,17 @@ static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client
                /* Connection established, no need to try other addresses. */
                break;
             }
-            log_error(LOG_LEVEL_CONNECT, "Could not connect to [%s]:%s: %s.",
-               csp->http->host_ip_addr_str, service, strerror(socket_error));
+            if (rp->ai_next != NULL)
+            {
+               /*
+                * There's another address we can try, so log that this
+                * one didn't work out. If the last one fails, too,
+                * it will get logged outside the loop body so we don't
+                * have to mention it here.
+                */
+               log_error(LOG_LEVEL_CONNECT, "Could not connect to [%s]:%s: %s.",
+                  csp->http->host_ip_addr_str, service, strerror(socket_error));
+            }
          }
          else
          {