Skip to content

Commit a3346c2

Browse files
committed
feat(agent): use same socket option for agent as go, fix potentially bad value in nginx
1 parent 5f546dd commit a3346c2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ngx_http_redirectionio_module_pool.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ ngx_int_t ngx_http_redirectionio_pool_construct(void **rp, void *params) {
4848
}
4949

5050
int tcp_nodelay = 1;
51+
int keep_alive = 1;
5152

5253
if (setsockopt(resource->peer.connection->fd, IPPROTO_TCP, TCP_NODELAY, (const void *) &tcp_nodelay, sizeof(int)) == -1) {
5354
ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_socket_errno, "setsockopt(TCP_NODELAY) %V failed, ignored", &resource->peer.connection->addr_text);
5455
}
5556

56-
if (setsockopt(resource->peer.connection->fd, IPPROTO_TCP, SO_KEEPALIVE, (const void *) &tcp_nodelay, sizeof(int)) == -1) {
57+
if (setsockopt(resource->peer.connection->fd, IPPROTO_TCP, SO_KEEPALIVE, (const void *) &keep_alive, sizeof(int)) == -1) {
5758
ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_socket_errno, "setsockopt(SO_KEEPALIVE) %V failed, ignored", &resource->peer.connection->addr_text);
5859
}
5960

0 commit comments

Comments
 (0)