[v9_18] Fix dig hanging issue in cases when the lookup's next query can't start
In recv_done(), when dig decides to start the lookup's next query in
the line using start_udp()
or start_tcp()
, and for some reason,
no queries get started, dig doesn't cancel the lookup.
This can occur, for example, when there are two queries in the lookup,
one with a regular IP address, and another with a IPv4 mapped IPv6
address. When the regular IP address fails to serve the query, its
recv_done()
callback starts the next query in the line (in this
case the one with a mapped IP address), but because dig
doesn't
connect to such IP addresses, and there are no other queries in the
list, no new queries are being started, and the lookup keeps hanging.
After calling start_udp()
or start_tcp()
in recv_done()
, check
if there are no pending/working queries then cancel the lookup instead
of only detaching from the current query.
Closes #3248 (closed)