Commit fb507315 authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] dig could miss tcp connections when cleaning up

3679.	[bug]		dig could fail to clean up TCP sockets still
			waiting on connect(). [RT #35074]
parent ae871ebb
3679. [bug] dig could fail to clean up TCP sockets still
waiting on connect(). [RT #35074]
3678. [port] Update config.guess and config.sub. [RT #35060]
3677. [bug] 'nsupdate' leaked memory if 'realm' was used multiple
......
......@@ -1325,6 +1325,7 @@ setup_libs(void) {
result = isc_mem_create(0, 0, &mctx);
check_result(result, "isc_mem_create");
isc_mem_setname(mctx, "dig", NULL);
result = isc_log_create(mctx, &lctx, &logconfig);
check_result(result, "isc_log_create");
......@@ -1343,6 +1344,7 @@ setup_libs(void) {
result = isc_task_create(taskmgr, 0, &global_task);
check_result(result, "isc_task_create");
isc_task_setname(global_task, "dig", NULL);
result = isc_timermgr_create(mctx, &timermgr);
check_result(result, "isc_timermgr_create");
......@@ -3735,18 +3737,31 @@ cancel_all(void) {
if (current_lookup != NULL) {
if (current_lookup->timer != NULL)
isc_timer_detach(&current_lookup->timer);
q = ISC_LIST_HEAD(current_lookup->q);
while (q != NULL) {
debug("canceling query %p, belonging to %p",
q, current_lookup);
for (q = ISC_LIST_HEAD(current_lookup->q);
q != NULL;
q = nq)
{
nq = ISC_LIST_NEXT(q, link);
if (q->sock != NULL) {
debug("canceling pending query %p, belonging to %p",
q, current_lookup);
if (q->sock != NULL)
isc_socket_cancel(q->sock, NULL,
ISC_SOCKCANCEL_ALL);
} else {
else
clear_query(q);
}
for (q = ISC_LIST_HEAD(current_lookup->connecting);
q != NULL;
q = nq)
{
nq = ISC_LIST_NEXT(q, clink);
debug("canceling connecting query %p, belonging to %p",
q, current_lookup);
if (q->sock != NULL)
isc_socket_cancel(q->sock, NULL,
ISC_SOCKCANCEL_ALL);
else
clear_query(q);
}
q = nq;
}
}
l = ISC_LIST_HEAD(lookup_list);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment