X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jbsockets.c;h=ecd5bd462d61c253b09c1e8ab43cbeee45234a47;hp=ae9e6bc25fb6b733749e327d5e042db6712dd547;hb=13844ebbe7cf4a4de64b28c60f5dc85acd2a4e52;hpb=204337f905aabfdc18467dba3987c0a8425d66f3 diff --git a/jbsockets.c b/jbsockets.c index ae9e6bc2..ecd5bd46 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.99 2011/04/19 13:00:47 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.102 2011/05/03 10:11:24 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -158,6 +158,7 @@ jb_socket connect_to(const char *host, int portnum, struct client_state *csp) fd = no_rfc2553_connect_to(host, portnum, csp); #endif if ((fd != JB_INVALID_SOCKET) || (errno == EINVAL) + || (csp->fwd == NULL) || ((csp->fwd->forward_host == NULL) && (csp->fwd->type == SOCKS_NONE))) { break; @@ -349,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 { @@ -543,11 +553,6 @@ int write_socket(jb_socket fd, const char *buf, size_t len) return 0; } - if (len < 0) /* constant condition - size_t isn't ever negative */ - { - return 1; - } - log_error(LOG_LEVEL_WRITING, "to socket %d: %N", fd, len, buf); #if defined(_WIN32)