thttpd: add THTTPD_NFILE_DESCRIPTORS limits instead of NFILE_DESCRIPTORS

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-03-15 16:46:10 +08:00 committed by Xiang Xiao
parent f8cb9db729
commit ff4c3c3fb8
3 changed files with 11 additions and 5 deletions

View File

@ -12,6 +12,12 @@ config NETUTILS_THTTPD
if NETUTILS_THTTPD
config THTTPD_NFILE_DESCRIPTORS
int "the maximum number of file descriptors for thttpd webserver"
default 16
---help---
The maximum number of file descriptors for thttpd webserver
config THTTPD_PORT
int "THTTPD port number"
default 80

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/thttpd/thttpd.c
* apps/netutils/thttpd/thttpd.c
* Tiny HTTP Server
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
@ -85,7 +85,7 @@
#define CNST_LINGERING 3
#define SPARE_FDS 2
#define AVAILABLE_FDS (CONFIG_NFILE_DESCRIPTORS - SPARE_FDS)
#define AVAILABLE_FDS (CONFIG_THTTPD_NFILE_DESCRIPTORS - SPARE_FDS)
/****************************************************************************
* Private Types
@ -696,7 +696,7 @@ int thttpd_main(int argc, char **argv)
* socket descriptors
*/
fw = fdwatch_initialize(CONFIG_NFILE_DESCRIPTORS);
fw = fdwatch_initialize(CONFIG_THTTPD_NFILE_DESCRIPTORS);
if (!fw)
{
nerr("ERROR: fdwatch initialization failure\n");

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/thttpd/thttpd_cgi.c
* apps/netutils/thttpd/thttpd_cgi.c
* CGI support
*
* Copyright (C) 2009, 2011, 2016 Gregory Nutt. All rights reserved.
@ -771,7 +771,7 @@ static int cgi_child(int argc, char **argv)
*/
ninfo("Closing descriptors\n");
for (fd = 3; fd < CONFIG_NFILE_DESCRIPTORS; fd++)
for (fd = 3; fd < CONFIG_THTTPD_NFILE_DESCRIPTORS; fd++)
{
/* Keep hc->conn_fd open for obvious reasons */