From fa02e3ae709a880e8e21212261cf6184814ebcb0 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Sun, 19 Oct 2014 08:08:45 +0200 Subject: [PATCH] Fix timeout issue with async stub TCP pipelining --- src/stub.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/stub.c b/src/stub.c index 3e9c5da0..e8963462 100644 --- a/src/stub.c +++ b/src/stub.c @@ -333,13 +333,20 @@ stub_cleanup(getdns_network_req *netreq) } static void -upstream_cleanup(getdns_upstream *upstream) +upstream_erred(getdns_upstream *upstream) { - while (upstream->write_queue) - stub_cleanup(upstream->write_queue); - while (upstream->netreq_by_query_id.count) - stub_cleanup((getdns_network_req *) - getdns_rbtree_first(&upstream->netreq_by_query_id)); + getdns_network_req *netreq; + + while ((netreq = upstream->write_queue)) { + stub_cleanup(netreq); + priv_getdns_check_dns_req_complete(netreq->owner); + } + while (upstream->netreq_by_query_id.count) { + netreq = (getdns_network_req *) + getdns_rbtree_first(&upstream->netreq_by_query_id); + stub_cleanup(netreq); + priv_getdns_check_dns_req_complete(netreq->owner); + } close(upstream->fd); upstream->fd = -1; } @@ -607,7 +614,7 @@ upstream_read_cb(void *userarg) return; case STUB_TCP_ERROR: - upstream_cleanup(upstream); + upstream_erred(upstream); return; default: