From c3b34b1a83c003bc878e2dd340f8eda34d8ea3cc Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Tue, 15 Jul 2014 22:52:25 -0400 Subject: [PATCH] Close socket upon completion of async DNS resolution --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/Util/DNS.pm | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 6404f996..311c5e75 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -7,6 +7,7 @@ [BUG FIXES] * No default for interactives made daemon die (H. Weber) + * Close socket upon completion of async DNS resolution 2.028001 - 2014-07-13 diff --git a/Netdisco/lib/App/Netdisco/Util/DNS.pm b/Netdisco/lib/App/Netdisco/Util/DNS.pm index eb32361e..04f538c3 100644 --- a/Netdisco/lib/App/Netdisco/Util/DNS.pm +++ b/Netdisco/lib/App/Netdisco/Util/DNS.pm @@ -103,7 +103,6 @@ addresses which resolved. sub hostnames_resolve_async { my $ips = shift; - my $resolver = AnyEvent::DNS->new(); my %HOSTS = (); $HOSTS{$_} = [ map { [ $_ ? (format_address $_->[0]) : '' ] } @@ -136,6 +135,9 @@ sub hostnames_resolve_async { # Wait for the resolver to perform all resolutions $done->recv; + + # Remove reference to resolver so that we close sockets + undef $AnyEvent::DNS::RESOLVER if $AnyEvent::DNS::RESOLVER; return $ips; }