Skip to content

Commit

Permalink
Also clear the authoritativeDnsServerCache when closing the Channel. (n…
Browse files Browse the repository at this point in the history
…etty#8174)

Motivation:

At the moment we only clear the resolveCache when the Channel is closed. We should also do the same for the authoritativeDnsServerCache.

Modifications:

Add authoritativeDnsServerCache.clear() to the Channel closeFuture.

Result:

Correctly clear all caches.
  • Loading branch information
normanmaurer authored Aug 6, 2018
1 parent 2c13f71 commit 55fec94
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public DnsNameResolver(
EventLoop eventLoop,
ChannelFactory<? extends DatagramChannel> channelFactory,
final DnsCache resolveCache,
DnsCache authoritativeDnsServerCache,
final DnsCache authoritativeDnsServerCache,
DnsQueryLifecycleObserverFactory dnsQueryLifecycleObserverFactory,
long queryTimeoutMillis,
ResolvedAddressTypes resolvedAddressTypes,
Expand Down Expand Up @@ -306,8 +306,9 @@ protected void initChannel(DatagramChannel ch) throws Exception {

ch.closeFuture().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
public void operationComplete(ChannelFuture future) {
resolveCache.clear();
authoritativeDnsServerCache.clear();
}
});
}
Expand Down

0 comments on commit 55fec94

Please sign in to comment.