upstream: made a few shutdown calls conditional
@@ -796,7 +796,10 @@ int flb_upstream_conn_timeouts(struct mk_list *list)
* waiting for I/O will receive the notification and trigger
* the error to it caller.
*/
+ if (u_conn->fd != -1) {
shutdown(u_conn->fd, SHUT_RDWR);
+ }
+
u_conn->net_error = ETIMEDOUT;
prepare_destroy_conn(u_conn);
}
@@ -806,7 +809,10 @@ int flb_upstream_conn_timeouts(struct mk_list *list)
mk_list_foreach_safe(u_head, tmp, &uq->av_queue) {
u_conn = mk_list_entry(u_head, struct flb_upstream_conn, _head);
if ((now - u_conn->ts_available) >= u->net.keepalive_idle_timeout) {
+ if (u_conn->fd != -1) {
shutdown(u_conn->fd, SHUT_RDWR);
+ }
+
prepare_destroy_conn(u_conn);
flb_debug("[upstream] drop keepalive connection #%i to %s:%i "
"(keepalive idle timeout)",
