Added a configurable listen() backlog (defaults to: server_listen_backlog=50)
This commit is contained in:
parent
7eef032584
commit
f076c67c33
|
@ -110,6 +110,7 @@
|
|||
/* default configuration values */
|
||||
#define DEF_SERVER_BIND_ADDR "any"
|
||||
#define DEF_SERVER_PORT 1511
|
||||
#define DEF_SERVER_BACKLOG 50
|
||||
#define DEF_HUB_NAME "uhub"
|
||||
#define DEF_HUB_DESCRIPTION ""
|
||||
#define DEF_HUB_ENABLED 1
|
||||
|
@ -180,6 +181,7 @@ void config_defaults(struct hub_config* config)
|
|||
DEFAULT_STRING (file_acl, DEF_FILE_ACL);
|
||||
DEFAULT_STRING (file_motd, DEF_FILE_MOTD);
|
||||
DEFAULT_INTEGER(server_port, DEF_SERVER_PORT);
|
||||
DEFAULT_INTEGER(server_listen_backlog, DEF_SERVER_BACKLOG);
|
||||
DEFAULT_INTEGER(max_users, DEF_MAX_USERS);
|
||||
DEFAULT_INTEGER(max_chat_history, DEF_MAX_CHAT_HISTORY);
|
||||
DEFAULT_INTEGER(max_logout_log, DEF_MAX_LOGOUT_LOG);
|
||||
|
@ -249,6 +251,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||
GET_STR (file_motd);
|
||||
GET_STR (server_bind_addr);
|
||||
GET_INT (server_port);
|
||||
GET_INT (server_listen_backlog);
|
||||
GET_STR (hub_name);
|
||||
GET_STR (hub_description);
|
||||
GET_BOOL(hub_enabled);
|
||||
|
@ -397,6 +400,7 @@ void dump_config(struct hub_config* config, int ignore_defaults)
|
|||
DUMP_STR (file_motd, DEF_FILE_MOTD);
|
||||
DUMP_STR (server_bind_addr, DEF_SERVER_BIND_ADDR);
|
||||
DUMP_INT (server_port, DEF_SERVER_PORT);
|
||||
DUMP_INT (server_listen_backlog, DEF_SERVER_BACKLOG);
|
||||
DUMP_STR (hub_name, DEF_HUB_NAME);
|
||||
DUMP_STR (hub_description, DEF_HUB_DESCRIPTION);
|
||||
DUMP_BOOL(hub_enabled, DEF_HUB_ENABLED);
|
||||
|
|
|
@ -24,6 +24,7 @@ struct hub_config
|
|||
{
|
||||
int server_port; /**<<< "Server port to bind to (default: 1511)" */
|
||||
char* server_bind_addr; /**<<< "Server bind address (default: '0.0.0.0' or '::')" */
|
||||
int server_listen_backlog; /**<<< "Server listen backlog (default: 50)" */
|
||||
int hub_enabled; /**<<< "Is server enabled (default: 1)" */
|
||||
int show_banner; /**<<< "Show banner on connect (default: 1)" */
|
||||
int max_users; /**<<< "Maximum number of users allowed on the hub (default: 500)" */
|
||||
|
|
|
@ -494,7 +494,7 @@ struct hub_info* hub_start_service(struct hub_config* config)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = net_listen(server_tcp, SERVER_BACKLOG);
|
||||
ret = net_listen(server_tcp, config->server_listen_backlog);
|
||||
if (ret == -1)
|
||||
{
|
||||
LOG_FATAL("hub_start_service(): Unable to listen to socket");
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#define SERVER_PORT 1511
|
||||
#define SERVER_ADDR_IPV6 "::"
|
||||
#define SERVER_ADDR_IPV4 "0.0.0.0"
|
||||
#define SERVER_BACKLOG 50
|
||||
|
||||
#ifndef WIN32
|
||||
#define SERVER_CONFIG "/etc/uhub/uhub.conf"
|
||||
|
|
Loading…
Reference in New Issue