Skip to content

Commit 8805662

Browse files
committed
Better option for sockets in agent
1 parent 30afc02 commit 8805662

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/ngx_http_redirectionio_module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include <ngx_http_redirectionio_module.h>
22

3+
ngx_http_output_header_filter_pt ngx_http_next_header_filter;
4+
ngx_http_output_body_filter_pt ngx_http_next_body_filter;
5+
ngx_module_t ngx_http_redirectionio_module;
6+
37
/**
48
* List of values for boolean
59
*/

src/ngx_http_redirectionio_module.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ ngx_int_t ngx_http_redirectionio_headers_filter(ngx_http_request_t *r);
108108

109109
ngx_int_t ngx_http_redirectionio_body_filter(ngx_http_request_t *r, ngx_chain_t *in);
110110

111-
ngx_http_output_header_filter_pt ngx_http_next_header_filter;
112-
ngx_http_output_body_filter_pt ngx_http_next_body_filter;
113-
ngx_module_t ngx_http_redirectionio_module;
111+
extern ngx_http_output_header_filter_pt ngx_http_next_header_filter;
112+
extern ngx_http_output_body_filter_pt ngx_http_next_body_filter;
113+
extern ngx_module_t ngx_http_redirectionio_module;
114114

115115
ngx_int_t ngx_http_redirectionio_pool_construct(void **resource, void *params);
116116
ngx_int_t ngx_http_redirectionio_pool_destruct(void *resource, void *params);

src/ngx_http_redirectionio_module_pool.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ ngx_int_t ngx_http_redirectionio_pool_construct(void **rp, void *params) {
5353
ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_socket_errno, "setsockopt(TCP_NODELAY) %V failed, ignored", &resource->peer.connection->addr_text);
5454
}
5555

56+
if (setsockopt(resource->peer.connection->fd, IPPROTO_TCP, SO_KEEPALIVE, (const void *) &tcp_nodelay, sizeof(int)) == -1) {
57+
ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_socket_errno, "setsockopt(SO_KEEPALIVE) %V failed, ignored", &resource->peer.connection->addr_text);
58+
}
59+
5660
resource->peer.connection->pool = pool;
5761
resource->peer.connection->read->handler = ngx_http_redirectionio_dummy_handler;
5862
resource->peer.connection->write->handler = ngx_http_redirectionio_dummy_handler;

0 commit comments

Comments
 (0)