mirror of
https://github.com/lxsang/ant-http
synced 2024-12-26 00:38:21 +01:00
scheduler timeout should be configurable
This commit is contained in:
parent
e9cd1addf7
commit
0daef95c25
@ -165,6 +165,10 @@ static int config_handler(void *conf, const char *section, const char *name,
|
||||
{
|
||||
pconfig->debug_enable = atoi(value);
|
||||
}
|
||||
else if (MATCH("SERVER", "scheduler_timeout"))
|
||||
{
|
||||
pconfig->scheduler_timeout = atoi(value);
|
||||
}
|
||||
#ifdef USE_ZLIB
|
||||
else if (MATCH("SERVER", "gzip_enable"))
|
||||
{
|
||||
@ -274,6 +278,7 @@ void load_config(const char *file)
|
||||
server_config.gzip_enable = 0;
|
||||
server_config.gzip_types = NULL;
|
||||
server_config.debug_enable = 0;
|
||||
server_config.scheduler_timeout = 30; // 30 s
|
||||
// put it default mimes
|
||||
for (int i = 0; _mimes[i].type != NULL; i++)
|
||||
{
|
||||
|
7
httpd.c
7
httpd.c
@ -306,6 +306,13 @@ void antd_scheduler_destroy_data(void *data)
|
||||
finish_request(data);
|
||||
}
|
||||
|
||||
int antd_scheduler_validate_data(antd_task_t *task)
|
||||
{
|
||||
config_t *conf = config();
|
||||
LOG("Use server configured scheduler timeout %d", conf->scheduler_timeout);
|
||||
return !(difftime(time(NULL), task->access_time) > conf->scheduler_timeout);
|
||||
}
|
||||
|
||||
int antd_task_data_id(void *data)
|
||||
{
|
||||
antd_request_t *rq = (antd_request_t *)data;
|
||||
|
@ -86,6 +86,7 @@ typedef struct
|
||||
int maxcon;
|
||||
int connection;
|
||||
int n_workers;
|
||||
int scheduler_timeout;
|
||||
int max_upload_size;
|
||||
// ssl
|
||||
int enable_ssl;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "utils.h"
|
||||
#include "bst.h"
|
||||
|
||||
#define MAX_VALIDITY_INTERVAL 30 // s
|
||||
#define MAX_VALIDITY_INTERVAL 30
|
||||
#define MAX_FIFO_NAME_SZ 255
|
||||
|
||||
// callback definition
|
||||
|
Loading…
Reference in New Issue
Block a user