diff --git a/daemon/main.c b/daemon/main.c index 094cb07c3..eb4c71a5f 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -808,7 +808,9 @@ 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"}, +#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 { "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"}, @@ -1052,11 +1054,13 @@ 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"); +#if LWS_LIBRARY_VERSION_MAJOR >= 3 || (LWS_LIBRARY_VERSION_MAJOR == 2 && LWS_LIBRARY_VERSION_MINOR >= 1) static const 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); +#endif if (graphitep) { if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.graphite_ep, graphitep)) diff --git a/daemon/websocket.c b/daemon/websocket.c index 94ea9011d..2c2267443 100644 --- a/daemon/websocket.c +++ b/daemon/websocket.c @@ -1160,7 +1160,9 @@ int websocket_init(void) { LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND | #endif 0, +#if LWS_LIBRARY_VERSION_MAJOR >= 3 || (LWS_LIBRARY_VERSION_MAJOR == 2 && LWS_LIBRARY_VERSION_MINOR >= 1) .pt_serv_buf_size = rtpe_config.http_buf_size > 0 ? rtpe_config.http_buf_size * 1024LL : 0, +#endif }; websocket_context = lws_create_context(&wci); err = "Failed to create LWS context"; @@ -1193,7 +1195,9 @@ int websocket_init(void) { .port = ep->port, .iface = g_strdup(sockaddr_print_buf(&ep->address)), .protocols = websocket_protocols, +#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 }; vhost->vhost_name = vhost->iface; if (ep->address.family->af == AF_INET) @@ -1244,7 +1248,9 @@ 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, +#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 // XXX cipher list, key password }; vhost->vhost_name = vhost->iface;