use heavy task by default

This commit is contained in:
lxsang 2018-10-14 20:41:44 +02:00
parent b0bbff1556
commit 487e5b108b
3 changed files with 7 additions and 3 deletions

View File

@ -189,7 +189,7 @@ void *accept_request(void *data)
int ret = -1, stat; int ret = -1, stat;
if (server_config.usessl == 1 && client->status == 0) 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); //LOG("Atttempt %d\n", client->attempt);
if (SSL_accept((SSL *)client->ssl) == -1) if (SSL_accept((SSL *)client->ssl) == -1)
{ {
@ -203,6 +203,7 @@ void *accept_request(void *data)
//LOG("RECALL %d\n", stat); //LOG("RECALL %d\n", stat);
task->handle = accept_request; task->handle = accept_request;
task->priority = HIGH_PRIORITY; task->priority = HIGH_PRIORITY;
task->type = LIGHT;
return task; return task;
default: default:
LOG("Error performing SSL handshake %d %d %lu\n", stat, ret, ERR_get_error()); LOG("Error performing SSL handshake %d %d %lu\n", stat, ret, ERR_get_error());

View File

@ -148,6 +148,7 @@ int main(int argc, char* argv[])
// reclaim data when exit // reclaim data when exit
pthread_detach(scheduler_th); pthread_detach(scheduler_th);
} }
antd_task_t* task = NULL;
while (scheduler.status) while (scheduler.status)
{ {
client_sock = accept(server_sock,(struct sockaddr *)&client_name,&client_name_len); client_sock = accept(server_sock,(struct sockaddr *)&client_name,&client_name_len);
@ -203,7 +204,9 @@ int main(int argc, char* argv[])
} }
#endif #endif
// create callback for the server // 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); close(server_sock);

View File

@ -224,7 +224,7 @@ antd_task_t* antd_create_task(void* (*handle)(void*), void *data, void* (*callba
task->handle = handle; task->handle = handle;
task->callback = callback_of(callback); task->callback = callback_of(callback);
task->priority = NORMAL_PRIORITY; task->priority = NORMAL_PRIORITY;
task->type = LIGHT; task->type = HEAVY; //LIGHT;
return task; return task;
} }