mirror of https://git.ffmpeg.org/ffmpeg.git
Make the maximum number of simultaneous HTTP connections handled by
ffserver a configuration parameter. The name of the new parameter introduced is MaxHTTPConnections. Originally committed as revision 15182 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
dc76fe1348
commit
1c9ff17920
|
@ -7,6 +7,11 @@ Port 8090
|
||||||
# several network interfaces.
|
# several network interfaces.
|
||||||
BindAddress 0.0.0.0
|
BindAddress 0.0.0.0
|
||||||
|
|
||||||
|
# Number of simultaneous HTTP connections that can be handled. It has
|
||||||
|
# to be defined *before* the MaxClients parameter, since it defines the
|
||||||
|
# MaxClients maximum limit.
|
||||||
|
MaxHTTPConnections 2000
|
||||||
|
|
||||||
# Number of simultaneous requests that can be handled. Since FFServer
|
# Number of simultaneous requests that can be handled. Since FFServer
|
||||||
# is very fast, it is more likely that you will want to leave this high
|
# is very fast, it is more likely that you will want to leave this high
|
||||||
# and use MaxBandwidth, below.
|
# and use MaxBandwidth, below.
|
||||||
|
|
23
ffserver.c
23
ffserver.c
|
@ -62,9 +62,6 @@ const int program_birth_year = 2000;
|
||||||
|
|
||||||
static const OptionDef options[];
|
static const OptionDef options[];
|
||||||
|
|
||||||
/* maximum number of simultaneous HTTP connections */
|
|
||||||
#define HTTP_MAX_CONNECTIONS 2000
|
|
||||||
|
|
||||||
enum HTTPState {
|
enum HTTPState {
|
||||||
HTTPSTATE_WAIT_REQUEST,
|
HTTPSTATE_WAIT_REQUEST,
|
||||||
HTTPSTATE_SEND_HEADER,
|
HTTPSTATE_SEND_HEADER,
|
||||||
|
@ -295,6 +292,8 @@ static int ffserver_daemon;
|
||||||
static int no_launch;
|
static int no_launch;
|
||||||
static int need_to_start_children;
|
static int need_to_start_children;
|
||||||
|
|
||||||
|
/* maximum number of simultaneous HTTP connections */
|
||||||
|
static unsigned int nb_max_http_connections = 2000;
|
||||||
static int nb_max_connections = 5;
|
static int nb_max_connections = 5;
|
||||||
static int nb_connections;
|
static int nb_connections;
|
||||||
|
|
||||||
|
@ -543,9 +542,14 @@ static int http_server(void)
|
||||||
{
|
{
|
||||||
int server_fd = 0, rtsp_server_fd = 0;
|
int server_fd = 0, rtsp_server_fd = 0;
|
||||||
int ret, delay, delay1;
|
int ret, delay, delay1;
|
||||||
struct pollfd poll_table[HTTP_MAX_CONNECTIONS + 2], *poll_entry;
|
struct pollfd *poll_table, *poll_entry;
|
||||||
HTTPContext *c, *c_next;
|
HTTPContext *c, *c_next;
|
||||||
|
|
||||||
|
if(!(poll_table = av_mallocz(nb_max_http_connections + 2))) {
|
||||||
|
http_log("Impossible to allocate a poll table handling %d connections.\n", nb_max_http_connections);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (my_http_addr.sin_port) {
|
if (my_http_addr.sin_port) {
|
||||||
server_fd = socket_open_listen(&my_http_addr);
|
server_fd = socket_open_listen(&my_http_addr);
|
||||||
if (server_fd < 0)
|
if (server_fd < 0)
|
||||||
|
@ -3816,10 +3820,19 @@ static int parse_ffconfig(const char *filename)
|
||||||
filename, line_num, arg);
|
filename, line_num, arg);
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(cmd, "MaxHTTPConnections")) {
|
||||||
|
get_arg(arg, sizeof(arg), &p);
|
||||||
|
val = atoi(arg);
|
||||||
|
if (val < 1 || val > 65536) {
|
||||||
|
fprintf(stderr, "%s:%d: Invalid MaxHTTPConnections: %s\n",
|
||||||
|
filename, line_num, arg);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
nb_max_http_connections = val;
|
||||||
} else if (!strcasecmp(cmd, "MaxClients")) {
|
} else if (!strcasecmp(cmd, "MaxClients")) {
|
||||||
get_arg(arg, sizeof(arg), &p);
|
get_arg(arg, sizeof(arg), &p);
|
||||||
val = atoi(arg);
|
val = atoi(arg);
|
||||||
if (val < 1 || val > HTTP_MAX_CONNECTIONS) {
|
if (val < 1 || val > nb_max_http_connections) {
|
||||||
fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n",
|
fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n",
|
||||||
filename, line_num, arg);
|
filename, line_num, arg);
|
||||||
errors++;
|
errors++;
|
||||||
|
|
Loading…
Reference in New Issue