*/
rad_listen_t *proxy_new_listener(home_server_t *home, int src_port)
{
+ time_t now;
rad_listen_t *this;
listen_socket_t *sock;
char buffer[256];
return NULL;
}
+ now = time(NULL);
+ if (home->last_failed_open == now) {
+ WDEBUG("Suppressing attempt to open socket to 'down' home server");
+ return NULL;
+ }
+
this = listen_alloc(mainconfig.config, RAD_LISTEN_PROXY);
sock = this->data;
}
#ifdef WITH_TCP
- sock->opened = sock->last_packet = time(NULL);
+ sock->opened = sock->last_packet = now;
if (home->proto == IPPROTO_TCP) {
this->recv = proxy_socket_tcp_recv;
*/
this->fd = fr_tcp_client_socket(&home->src_ipaddr,
&home->ipaddr, home->port);
-#ifdef WITH_TLS
if (home->tls) {
DEBUG("Trying SSL to port %d\n", home->port);
sock->ssn = tls_new_client_session(home->tls, this->fd);
if (!sock->ssn) {
+ ERROR("Failed starting SSL to %s", buffer);
+ home->last_failed_open = now;
listen_free(&this);
return NULL;
}
this->recv = proxy_tls_recv;
this->send = proxy_tls_send;
}
-#endif
} else
#endif
this->fd = fr_socket(&home->src_ipaddr, src_port);
if (this->fd < 0) {
this->print(this, buffer,sizeof(buffer));
- DEBUG("Failed opening client socket ::%s:: : %s",
+ ERROR("Failed opening client socket %s : %s",
buffer, fr_strerror());
+ home->last_failed_open = now;
listen_free(&this);
return NULL;
}
&sizeof_src) < 0) {
ERROR("Failed getting socket name: %s",
fr_syserror(errno));
+ home->last_failed_open = now;
listen_free(&this);
return NULL;
}
if (!fr_sockaddr2ipaddr(&src, sizeof_src,
&sock->my_ipaddr, &sock->my_port)) {
ERROR("Socket has unsupported address family");
+ home->last_failed_open = now;
listen_free(&this);
return NULL;
}