Skip to content

Commit

Permalink
in_splunk: http_server: Move downstream's net.keepalive settings
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jun 28, 2024
1 parent 4ea0cec commit 5534d44
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
13 changes: 1 addition & 12 deletions plugins/in_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static int in_splunk_init(struct flb_input_instance *ins,
unsigned short int port;
int ret;
struct flb_splunk *ctx;
int http2_flags = 0;

(void) data;

Expand All @@ -96,13 +95,9 @@ static int in_splunk_init(struct flb_input_instance *ins,


if (ctx->enable_http2) {
http2_flags = FLB_HTTP_SERVER_FLAG_AUTO_INFLATE;
if (ctx->auto_keepalive) {
http2_flags |= FLB_HTTP_SERVER_FLAG_KEEPALIVE;
}
ret = flb_http_server_init(&ctx->http_server,
HTTP_PROTOCOL_AUTODETECT,
http2_flags,
FLB_HTTP_SERVER_FLAG_AUTO_INFLATE,
NULL,
ins->host.listen,
ins->host.port,
Expand Down Expand Up @@ -217,12 +212,6 @@ static struct flb_config_map config_map[] = {
NULL
},

{
FLB_CONFIG_MAP_BOOL, "keepalive", "Off",
0, FLB_TRUE, offsetof(struct flb_splunk, auto_keepalive),
"Enable keepalive automatically when enabled HTTP2"
},

{
FLB_CONFIG_MAP_SIZE, "buffer_max_size", HTTP_BUFFER_MAX_SIZE,
0, FLB_TRUE, offsetof(struct flb_splunk, buffer_max_size),
Expand Down
3 changes: 0 additions & 3 deletions plugins/in_splunk/splunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ struct flb_splunk {
int enable_http2;
struct flb_http_server http_server;

/* Auto Keepalive? */
int auto_keepalive;

/* Legacy HTTP server */
flb_sds_t success_headers_str;
int collector_id;
Expand Down
5 changes: 5 additions & 0 deletions src/flb_downstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ struct flb_config_map downstream_net[] = {
"disabled, the timeout is logged as a debug message"
},

{
FLB_CONFIG_MAP_BOOL, "net.keepalive", "true",
0, FLB_TRUE, offsetof(struct flb_net_setup, keepalive),
"Enable keepalive on setup downstream",
},
/* EOF */
{0}
};
Expand Down
4 changes: 4 additions & 0 deletions src/http_server/flb_http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ int flb_http_server_init(struct flb_http_server *session,

session->downstream = NULL;

if (networking_setup->keepalive) {
session->flags = FLB_HTTP_SERVER_FLAG_KEEPALIVE | FLB_HTTP_SERVER_FLAG_AUTO_INFLATE;
}

cfl_list_init(&session->clients);

MK_EVENT_NEW(&session->listener_event);
Expand Down

0 comments on commit 5534d44

Please sign in to comment.