+RETSIGTYPE
+sigalrm_handler(int a)
+{
+ config_t const *cfg;
+cp
+ cfg = get_next_config_val(upstreamip, upstreamindex++);
+
+ while(cfg)
+ {
+ if(!setup_outgoing_connection(cfg->data.ptr)) /* function returns 0 when there are no problems */
+ {
+ signal(SIGALRM, SIG_IGN);
+ return;
+ }
+ cfg = get_next_config_val(upstreamip, upstreamindex++); /* Or else we try the next ConnectTo line */
+ }
+
+ signal(SIGALRM, sigalrm_handler);
+ upstreamindex = 0;
+ seconds_till_retry += 5;
+ if(seconds_till_retry > MAXTIMEOUT) /* Don't wait more than MAXTIMEOUT seconds. */
+ seconds_till_retry = MAXTIMEOUT;
+ syslog(LOG_ERR, _("Still failed to connect to other, will retry in %d seconds"),
+ seconds_till_retry);
+ alarm(seconds_till_retry);
+cp
+}
+