From: Wolfgang Bumiller Date: Thu, 21 May 2015 11:07:41 +0000 (+0200) Subject: cache address families for known nodes X-Git-Url: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff_plain;h=fc31f517441deb227d4dc5582bf054bc063f69c7 cache address families for known nodes --- diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm index 69eda6d..09ddf01 100644 --- a/data/PVE/Cluster.pm +++ b/data/PVE/Cluster.pm @@ -1010,8 +1010,14 @@ sub remote_node_ip { my $nodelist = $clinfo->{nodelist}; if ($nodelist && $nodelist->{$nodename}) { if (my $ip = $nodelist->{$nodename}->{ip}) { - return wantarray ? ($ip, PVE::Tools::get_host_address_family($ip)) - : $ip; + return $ip if !wantarray; + my $family = $nodelist->{$nodename}->{address_family}; + if (!$family) { + $nodelist->{$nodename}->{address_family} = + $family = + PVE::Tools::get_host_address_family($ip); + } + return ($ip, $family); } }