Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions daemon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
#if LWS_LIBRARY_VERSION_MAJOR >= 3 || (LWS_LIBRARY_VERSION_MAJOR == 2 && LWS_LIBRARY_VERSION_MINOR >= 1)
{ "http-buf-size", 0,0, G_OPTION_ARG_INT, &rtpe_config.http_buf_size,"Send buffer size for HTTP and WS in kB","INT"},
#endif
{ "http-idle-timeout", 0,0, G_OPTION_ARG_INT, &rtpe_config.http_keepalive_timeout,"Seconds to allow idle HTTP/HTTPS keepalive (0 = libwebsockets default, 5s for HTTP/1.1)","INT"},
{ "software-id", 0,0, G_OPTION_ARG_STRING, &rtpe_config.software_id,"Identification string of this software presented to external systems","STRING"},
{ "poller-per-thread", 0,0, G_OPTION_ARG_NONE, &rtpe_config.poller_per_thread, "Use poller per thread", NULL },
{ "timer-accuracy", 0,0,G_OPTION_ARG_INT, &rtpe_config.timer_accuracy,"Minimum number of microseconds to sleep","INT"},
Expand Down Expand Up @@ -1084,6 +1085,8 @@ static void options(int *argc, char ***argv, charp_ht templates) {
if (rtpe_config.http_buf_size >= max_buf_size)
die("Option 'http-buf-size' too large (must be <%zu)", max_buf_size);
#endif
if (rtpe_config.http_keepalive_timeout < 0)
die("Option 'http-idle-timeout' must be >= 0");

if (graphitep) {
if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.graphite_ep, graphitep))
Expand Down
2 changes: 2 additions & 0 deletions daemon/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,7 @@ int websocket_init(void) {
.port = ep->port,
.iface = g_strdup(sockaddr_print_buf(&ep->address)),
.protocols = websocket_protocols,
.keepalive_timeout = rtpe_config.http_keepalive_timeout,
#if LWS_LIBRARY_VERSION_MAJOR >= 3 || (LWS_LIBRARY_VERSION_MAJOR == 2 && LWS_LIBRARY_VERSION_MINOR >= 1)
.pt_serv_buf_size = wci.pt_serv_buf_size,
#endif
Expand Down Expand Up @@ -1245,6 +1246,7 @@ int websocket_init(void) {
.port = ep->port,
.iface = g_strdup(sockaddr_print_buf(&ep->address)),
.protocols = websocket_protocols,
.keepalive_timeout = rtpe_config.http_keepalive_timeout,
.ssl_cert_filepath = rtpe_config.https_cert,
.ssl_private_key_filepath = rtpe_config.https_key ? : rtpe_config.https_cert,
.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT,
Expand Down
7 changes: 7 additions & 0 deletions docs/rtpengine.md
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,13 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp-
megabyte) or larger if you experience high WS activity, to improve
performance and prevent possible protocol hiccups.

- __\-\-http-idle-timeout=__*INT*

Seconds to allow idle HTTP/HTTPS keepalive connections before the server
closes them. If zero (the default), the libwebsockets default is used
(5 seconds for HTTP/1.1). Set to a positive value (e.g. 60) to align with
load balancer idle timeouts or to keep connections open longer.

- __\-\-software-id=__*STRING*

Sets a free-form string that is used to identify this software towards external
Expand Down
1 change: 1 addition & 0 deletions etc/rtpengine.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ tos = 184
# media-num-threads = 8
# http-threads = 4
# http-buf-size = 1024
# http-idle-timeout = 0

port-min = 30000
port-max = 39999
Expand Down
1 change: 1 addition & 0 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ enum endpoint_learning {
X(ng_client_timeout) \
X(ng_client_retries) \
X(http_buf_size) \
X(http_keepalive_timeout) \

#define RTPE_CONFIG_INT64_PARAMS \
X(bw_limit) \
Expand Down
2 changes: 1 addition & 1 deletion t/auto-daemon-tests-http.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$NGCP::Rtpengine::AutoTest::host = 'http://localhost:6666/ng';

autotest_start(qw(--config-file=none -t -1 -i 203.0.113.1 -i 2001:db8:4321::1
--listen-http=localhost:6666 -f -L 7 -E))
--listen-http=localhost:6666 --http-idle-timeout=5 -f -L 7 -E))
or die;


Expand Down