From 487e5b108b1c1f214604027330b16e0dd7c2a631 Mon Sep 17 00:00:00 2001 From: lxsang Date: Sun, 14 Oct 2018 20:41:44 +0200 Subject: [PATCH] use heavy task by default --- http_server.c | 3 ++- httpd.c | 5 ++++- libs/scheduler.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/http_server.c b/http_server.c index caac537..e9d4d4e 100644 --- a/http_server.c +++ b/http_server.c @@ -189,7 +189,7 @@ void *accept_request(void *data) int ret = -1, stat; if (server_config.usessl == 1 && client->status == 0) { - if(client->attempt > MAX_ATTEMPT) return task; + //if(client->attempt > MAX_ATTEMPT) return task; //LOG("Atttempt %d\n", client->attempt); if (SSL_accept((SSL *)client->ssl) == -1) { @@ -203,6 +203,7 @@ void *accept_request(void *data) //LOG("RECALL %d\n", stat); task->handle = accept_request; task->priority = HIGH_PRIORITY; + task->type = LIGHT; return task; default: LOG("Error performing SSL handshake %d %d %lu\n", stat, ret, ERR_get_error()); diff --git a/httpd.c b/httpd.c index aeebb04..89a3f44 100644 --- a/httpd.c +++ b/httpd.c @@ -148,6 +148,7 @@ int main(int argc, char* argv[]) // reclaim data when exit pthread_detach(scheduler_th); } + antd_task_t* task = NULL; while (scheduler.status) { client_sock = accept(server_sock,(struct sockaddr *)&client_name,&client_name_len); @@ -203,7 +204,9 @@ int main(int argc, char* argv[]) } #endif // create callback for the server - antd_add_task(&scheduler, antd_create_task(accept_request,(void*)request, finish_request )); + task = antd_create_task(accept_request,(void*)request, finish_request ); + task->type = LIGHT; + antd_add_task(&scheduler, task); } close(server_sock); diff --git a/libs/scheduler.c b/libs/scheduler.c index 84f3fe9..6599442 100644 --- a/libs/scheduler.c +++ b/libs/scheduler.c @@ -224,7 +224,7 @@ antd_task_t* antd_create_task(void* (*handle)(void*), void *data, void* (*callba task->handle = handle; task->callback = callback_of(callback); task->priority = NORMAL_PRIORITY; - task->type = LIGHT; + task->type = HEAVY; //LIGHT; return task; }