server session BUGFIX do not consider -1 as pending socket
@@ -3149,6 +3149,7 @@ nc_connect_ch_endpt(struct nc_ch_endpt *endpt, struct nc_session **session)
sock = nc_sock_connect(endpt->address, endpt->port, NC_SOCKET_CH_TIMEOUT, &endpt->ka, &endpt->sock_pending, &ip_host);
if (sock < 0) {
+ if (endpt->sock_pending > -1) {
++endpt->sock_retries;
if (endpt->sock_retries == NC_SOCKET_CH_RETRIES) {
ERR("Failed to connect socket %d after %d retries, closing.", endpt->sock_pending, NC_SOCKET_CH_RETRIES);
@@ -3156,6 +3157,7 @@ nc_connect_ch_endpt(struct nc_ch_endpt *endpt, struct nc_session **session)
endpt->sock_pending = -1;
endpt->sock_retries = 0;
}
+ }
return NC_MSG_ERROR;
}
/* no need to store the socket as pending any longer */
