Skip to content

Commit

Permalink
io: added tcp keepalive support
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Nov 9, 2024
1 parent c32719c commit 4c2b725
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/flb_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ int flb_io_net_connect(struct flb_connection *connection,
connection->upstream->tcp_port);
}

/* set TCP keepalive and it's options */
if (connection->net->tcp_keepalive) {
ret = flb_net_socket_tcp_keepalive(connection->fd,
connection->net);

if (ret == -1) {
flb_socket_close(fd);

return -1;
}
}

#ifdef FLB_HAVE_TLS
/* Check if TLS was enabled, if so perform the handshake */
if (flb_stream_is_secure(connection->stream) &&
Expand Down

0 comments on commit 4c2b725

Please sign in to comment.