net/tcp/tcp_backlog.c: Add SOMAXCONN definition and implementaton per OpenGroup.org.

This commit is contained in:
zhangyuan7 2018-11-09 11:20:33 -06:00 committed by Gregory Nutt
parent d2cfd398ba
commit f036e2a32a
3 changed files with 25 additions and 0 deletions

View File

@ -220,6 +220,14 @@
* operations
*/
/* The maximum backlog queue length */
#ifdef CONFIG_NET_TCPBACKLOG_CONNS
# define SOMAXCONN CONFIG_NET_TCPBACKLOG_CONNS
#else
# define SOMAXCONN 0
#endif
/****************************************************************************
* Type Definitions
****************************************************************************/

View File

@ -147,6 +147,16 @@ config NET_TCPBACKLOG
Incoming connections pend in a backlog until accept() is called.
The size of the backlog is selected when listen() is called.
if NET_TCPBACKLOG
config NET_TCPBACKLOG_CONNS
int "TCP backlog conns threshold"
default 8
---help---
Maximum number of TCP backlog connections (all tasks).
endif # NET_TCPBACKLOG
config NET_TCP_SPLIT
bool "Enable packet splitting"
default n

View File

@ -89,6 +89,13 @@ int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg)
if (nblg > 0)
{
/* nblog value must less than SOMAXCONN */
if (nblg > SOMAXCONN)
{
nblg = SOMAXCONN;
}
/* Align the list of backlog structures to 32-bit boundaries. This
* may be excessive on 24-16-bit address machines; and insufficient
* on 64-bit address machines -- REVISIT