Also remove the id from the DnsQueryContextManager if query fails due parent Channel activation error.
Motivation: Whenever we fail the query we should also remove the id from the DnsQueryContextManager. Modifications: Remove the id from the DnsQueryContextManager if we fail the query because the channel failed to become active. Result: More correct code.
This commit is contained in:
parent
00afb19d7a
commit
5e42e758be
@ -115,10 +115,13 @@ final class DnsQueryContext {
|
|||||||
} else {
|
} else {
|
||||||
parent.channelFuture.addListener(new GenericFutureListener<Future<? super Channel>>() {
|
parent.channelFuture.addListener(new GenericFutureListener<Future<? super Channel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(Future<? super Channel> future) throws Exception {
|
public void operationComplete(Future<? super Channel> future) {
|
||||||
if (future.isSuccess()) {
|
if (future.isSuccess()) {
|
||||||
writeQuery(query, writePromise);
|
writeQuery(query, writePromise);
|
||||||
} else {
|
} else {
|
||||||
|
// Remove the id from the manager as we fail the query.
|
||||||
|
parent.queryContextManager.remove(nameServerAddr(), id);
|
||||||
|
|
||||||
Throwable cause = future.cause();
|
Throwable cause = future.cause();
|
||||||
promise.tryFailure(cause);
|
promise.tryFailure(cause);
|
||||||
writePromise.setFailure(cause);
|
writePromise.setFailure(cause);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user