Browse Source

MT#55283 add http-buf-size option

closes #1950

Change-Id: I12047e7e6af8e0d927744a0dc70c5b4668420878
pull/1967/head
Richard Fuchs 5 months ago
parent
commit
f5277e5c30
5 changed files with 21 additions and 0 deletions
  1. +8
    -0
      daemon/main.c
  2. +3
    -0
      daemon/websocket.c
  3. +8
    -0
      docs/rtpengine.md
  4. +1
    -0
      etc/rtpengine.conf
  5. +1
    -0
      include/main.h

+ 8
- 0
daemon/main.c View File

@ -22,6 +22,7 @@
#ifndef WITHOUT_NFTABLES
#include <linux/netfilter.h>
#endif
#include <libwebsockets.h>
#include "poller.h"
#include "control_tcp.h"
@ -807,6 +808,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
{ "https-cert", 0,0, G_OPTION_ARG_FILENAME, &rtpe_config.https_cert,"Certificate for HTTPS and WSS","FILE"},
{ "https-key", 0,0, G_OPTION_ARG_FILENAME, &rtpe_config.https_key, "Private key for HTTPS and WSS","FILE"},
{ "http-threads", 0,0, G_OPTION_ARG_INT, &rtpe_config.http_threads,"Number of worker threads for HTTP and WS","INT"},
{ "http-buf-size", 0,0, G_OPTION_ARG_INT, &rtpe_config.http_buf_size,"Send buffer size for HTTP and WS in kB","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"},
@ -1050,6 +1052,12 @@ static void options(int *argc, char ***argv, charp_ht templates) {
die("Missing option --listen-tcp, --listen-udp, --listen-ng, --listen-tcp-ng, "
"--listen-http, or --listen-https");
const static size_t max_buf_size =
((1LL << (sizeof(((struct lws_context_creation_info) {}).pt_serv_buf_size) * 8 - 1))
- 1) / 1024;
if (rtpe_config.http_buf_size >= max_buf_size)
die("Option 'http-buf-size' too large (must be <%zu)", max_buf_size);
if (graphitep) {
if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.graphite_ep, graphitep))
die("Invalid IP or port '%s' (--graphite)", graphitep);


+ 3
- 0
daemon/websocket.c View File

@ -1160,6 +1160,7 @@ int websocket_init(void) {
LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND |
#endif
0,
.pt_serv_buf_size = rtpe_config.http_buf_size > 0 ? rtpe_config.http_buf_size * 1024LL : 0,
};
websocket_context = lws_create_context(&wci);
err = "Failed to create LWS context";
@ -1192,6 +1193,7 @@ int websocket_init(void) {
.port = ep->port,
.iface = g_strdup(sockaddr_print_buf(&ep->address)),
.protocols = websocket_protocols,
.pt_serv_buf_size = wci.pt_serv_buf_size,
};
vhost->vhost_name = vhost->iface;
if (ep->address.family->af == AF_INET)
@ -1242,6 +1244,7 @@ int websocket_init(void) {
.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,
.pt_serv_buf_size = wci.pt_serv_buf_size,
// XXX cipher list, key password
};
vhost->vhost_name = vhost->iface;


+ 8
- 0
docs/rtpengine.md View File

@ -989,6 +989,14 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp-
number as given under __num-threads__ will be used. If no HTTP listeners are
enabled, then no threads are created.
- __\-\-http-buf-size=__*INT*
Set the internal buffer size used by the HTTP/HTTPS/WS/WSS library, in
kilobytes. If unset or less than or equal to zero, then the
implementation-defined default will be used. Set this to 1024 (one
megabyte) or larger if you experience high WS activity, to improve
performance and prevent possible protocol hiccups.
- __\-\-software-id=__*STRING*
Sets a free-form string that is used to identify this software towards external


+ 1
- 0
etc/rtpengine.conf View File

@ -49,6 +49,7 @@ tos = 184
# num-threads = 16
# media-num-threads = 8
# http-threads = 4
# http-buf-size = 1024
port-min = 30000
port-max = 39999


+ 1
- 0
include/main.h View File

@ -89,6 +89,7 @@ enum endpoint_learning {
X(timer_accuracy) \
X(ng_client_timeout) \
X(ng_client_retries) \
X(http_buf_size) \
#define RTPE_CONFIG_INT64_PARAMS \
X(bw_limit) \


Loading…
Cancel
Save