1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

allow LWS_SOMAXCONN to be defined at configuretime

Default remains at SOMAXCONN, you can force it at configure time
along these lines

./configure CFLAGS="-DLWS_SOMAXCONN=16384"

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-01-15 20:52:29 +08:00
parent 5fc460cd41
commit a824d18bc5
3 changed files with 18 additions and 1 deletions

View file

@ -145,6 +145,20 @@ you can set it here
- LWS_MAX_ZLIB_CONN_BUFFER maximum size a compression buffer is allowed to
grow to before closing the connection. Default is 64KBytes.
- LWS_SOMAXCONN maximum number of pending connect requests the listening
socket can cope with. Default is SOMAXCONN. If you need to use synthetic
tests that just spam hundreds of connect requests at once without dropping
any, you can try setting this to MAX_CLIENTS and mess with your box's tcp
config like this (courtesy Edwin van der Oetelaar)
echo "2048 64512" > /proc/sys/net/ipv4/ip_local_port_range
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
echo "10" > /proc/sys/net/ipv4/tcp_fin_timeout
echo "65536" > /proc/sys/net/core/somaxconn
echo "65536" > /proc/sys/net/ipv4/tcp_max_syn_backlog
echo "262144" > /proc/sys/net/netfilter/nf_conntrack_max
Testing server with a browser
-----------------------------

View file

@ -3040,7 +3040,7 @@ libwebsocket_create_context(int port, const char *interf,
wsi->mode = LWS_CONNMODE_SERVER_LISTENER;
insert_wsi(context, wsi);
listen(sockfd, SOMAXCONN);
listen(sockfd, LWS_SOMAXCONN);
lwsl_info(" Listening on port %d\n", port);
/* list in the internal poll array */

View file

@ -160,6 +160,9 @@ extern void _lws_log(int filter, const char *format, ...);
#ifndef CIPHERS_LIST_STRING
#define CIPHERS_LIST_STRING "DEFAULT"
#endif
#ifndef LWS_SOMAXCONN
#define LWS_SOMAXCONN SOMAXCONN
#endif
#define MAX_WEBSOCKET_04_KEY_LEN 128