Hi guys:
I’m reading the source code of version 1.6.2, in function listener_accept:

/* Note: if we fail to allocate a connection because of configured
* limits, we'll schedule a new attempt worst 1 second later in the
* worst case. If we fail due to system limits or temporary resource
* shortage, we try again 100ms later in the worst case.
*/
while (max_accept--) {
struct sockaddr_storage addr;
socklen_t laddr = sizeof(addr);

if (unlikely(actconn >= global.maxconn) && !(l->options & LI_O_UNLIMITED)) {
limit_listener(l, &global_listener_queue);
task_schedule(global_listener_queue_task, tick_add(now_ms, 1000)); /* try again 
in 1 second */
return;
}

if (unlikely(p && p->feconn >= p->maxconn)) {
limit_listener(l, &p->listener_queue);   <―――here is my question.
return;
}

My question is why the task_schedule is not called again here? Any purpose?
In my knowledge, if the upper limit is reached, we should re-schedule the task 
with expire time, and the listener will wake up when the task is ran.

With great thanks,
Zhou

Reply via email to