mirror of
https://github.com/lxsang/ant-http
synced 2024-12-26 16:58:22 +01:00
use both readable event and timeout event
This commit is contained in:
parent
1883330bba
commit
899687d255
@ -785,7 +785,7 @@ static void *proxy_monitor(void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sz2 = read_buf(proxy, buf, BUFFLEN);
|
sz2 = antd_recv_upto(proxy, buf, BUFFLEN);
|
||||||
if (sz2 < 0 || (sz2 > 0 && antd_send(rq->client, buf, sz2) != sz2))
|
if (sz2 < 0 || (sz2 > 0 && antd_send(rq->client, buf, sz2) != sz2))
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -812,9 +812,17 @@ static void *proxy_monitor(void *data)
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(pfd[0].revents & POLLIN)
|
||||||
|
{
|
||||||
|
antd_task_bind_event(task, proxy->sock, 0, TASK_EVT_ON_READABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
antd_task_bind_event(task, proxy->sock, 100u, TASK_EVT_ON_TIMEOUT);
|
||||||
|
}
|
||||||
task->handle = proxy_monitor;
|
task->handle = proxy_monitor;
|
||||||
task->access_time = rq->client->last_io;
|
task->access_time = rq->client->last_io;
|
||||||
antd_task_bind_event(task, proxy->sock, 0, TASK_EVT_ON_READABLE);
|
|
||||||
antd_task_bind_event(task, rq->client->sock, 0, TASK_EVT_ON_READABLE);
|
antd_task_bind_event(task, rq->client->sock, 0, TASK_EVT_ON_READABLE);
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
8
httpd.c
8
httpd.c
@ -308,12 +308,12 @@ void antd_scheduler_destroy_data(void *data)
|
|||||||
|
|
||||||
int antd_task_data_id(void *data)
|
int antd_task_data_id(void *data)
|
||||||
{
|
{
|
||||||
/*antd_request_t *rq = (antd_request_t *)data;
|
antd_request_t *rq = (antd_request_t *)data;
|
||||||
if(!rq)
|
if(!rq)
|
||||||
return 0;
|
return 0;
|
||||||
return antd_scheduler_next_id(scheduler,rq->client->sock);*/
|
return antd_scheduler_next_id(scheduler,rq->client->sock);
|
||||||
UNUSED(data);
|
/*UNUSED(data);
|
||||||
return antd_scheduler_next_id(scheduler,0);
|
return antd_scheduler_next_id(scheduler,0);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
Loading…
Reference in New Issue
Block a user