current jbsockets.c,1.144,1.145

Fabian Keil via ijbswa-commits <[email protected]> Thu, 08 Jun 2017 13:04:58 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31440

Modified Files:
	jbsockets.c 
Log Message:
rfc2553_connect_to(): Properly detect and log when poll() reached the time out

Previously this was logged as:
Could not connect to [...]: No error: 0.
which isn't very helpful.

The select() code path doesn't look like it would handle timeouts
properly either but apparently nobody noticed this yet ...

Sponsored by: Robert Klemme


Index: jbsockets.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jbsockets.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -C2 -d -r1.144 -r1.145
*** jbsockets.c	8 Jun 2017 13:04:34 -0000	1.144
--- jbsockets.c	8 Jun 2017 13:04:56 -0000	1.145
***************
*** 374,378 ****
        poll_fd[0].events = POLLOUT;
  
!       if (poll(poll_fd, 1, 30000) > 0)
  #else
        /* wait for connection to complete */
--- 374,397 ----
        poll_fd[0].events = POLLOUT;
  
!       retval = poll(poll_fd, 1, 30000);
!       if (retval == 0)
!       {
!          if (rp->ai_next != NULL)
!          {
!             /* Log this now as we'll try another address next */
!             log_error(LOG_LEVEL_CONNECT,
!                "Could not connect to [%s]:%s: Operation timed out.",
!                csp->http->host_ip_addr_str, service);
!          }
!          else
!          {
!             /*
!              * This is the last address, don't log this now
!              * as it would result in a duplicated log message.
!              */
!             socket_error = ETIMEDOUT;
!          }
!       }
!       else if (retval > 0)
  #else
        /* wait for connection to complete */


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot