Ensure we always release the AddressEnvelope when doing DNS queries.
Motivation: When we do DNS queries we need to ensure we always release the AddressEnvelope. Modifications: Also release the AddressEnvelope if the original resolution was done in the meantime and we did not cancel the extra query yet. Result: Should fix [#7713]
This commit is contained in:
parent
f40ecc3f10
commit
c6c0984b8e
@ -325,6 +325,13 @@ abstract class DnsNameResolverContext<T> {
|
|||||||
|
|
||||||
if (promise.isDone() || future.isCancelled()) {
|
if (promise.isDone() || future.isCancelled()) {
|
||||||
queryLifecycleObserver.queryCancelled(allowedQueries);
|
queryLifecycleObserver.queryCancelled(allowedQueries);
|
||||||
|
|
||||||
|
// Check if we need to release the envelope itself. If the query was cancelled the getNow() will
|
||||||
|
// return null as well as the Future will be failed with a CancellationException.
|
||||||
|
AddressedEnvelope<DnsResponse, InetSocketAddress> result = future.getNow();
|
||||||
|
if (result != null) {
|
||||||
|
result.release();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user