Skip to content
Snippets Groups Projects
Commit b9b760c6 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Thread state should be checked after each request.

Otherwise it would finish all pending queries, some of which may have
connection already dropped. This usually isn't a problem, it just
presents a longer wait for the timeouts.
parent 5f630099
No related branches found
No related tags found
No related merge requests found
......@@ -1078,30 +1078,26 @@ int xfr_worker(dthread_t *thread)
fdset_it_t it;
fdset_begin(w->pool.fds, &it);
while(nfds > 0) {
/* Find data. */
knot_ns_xfr_t *rq = xfr_task_get(w, it.fd);
dbg_xfr_verb("xfr: worker=%p processing event on "
"fd=%d data=%p.\n",
w, it.fd, rq);
if (rq) {
/* Check task state. */
if (rq->flags & XFR_FLAG_CONNECTING) {
ret = xfr_task_process(w, rq, buf, buflen);
} else {
ret = xfr_process_event(w, rq);
}
/* Check task state. */
if (ret != KNOT_EOK) {
xfr_task_remove(w, it.fd);
--it.pos; /* Reset iterator */
}
}
/* Next fd. */
if (fdset_next(w->pool.fds, &it) < 0) {
/* Check for cancellation or next active fd. */
if (dt_is_cancelled(thread))
break;
if (fdset_next(w->pool.fds, &it) < 0)
break;
}
}
/* Sweep inactive. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment