avoid unecessary log for queueing

This commit is contained in:
Oliver Gorwits
2013-05-29 19:54:09 +01:00
parent d5565423f2
commit e0ee25628f

View File

@@ -119,7 +119,7 @@ sub _set_canonical_ip {
my $oldip = $device->ip; my $oldip = $device->ip;
my $newip = $snmp->root_ip; my $newip = $snmp->root_ip;
if (length $newip) { if (defined $newip) {
if ($oldip ne $newip) { if ($oldip ne $newip) {
debug sprintf ' [%s] device - changing root IP to alt IP %s', debug sprintf ' [%s] device - changing root IP to alt IP %s',
$oldip, $newip; $oldip, $newip;
@@ -666,11 +666,13 @@ sub store_neighbors {
' [%s] neigh - port %s has multiple neighbors, setting remote as self', ' [%s] neigh - port %s has multiple neighbors, setting remote as self',
$device->ip, $port; $device->ip, $port;
foreach my $n (@$remote_ip) { if (wantarray) {
debug sprintf foreach my $n (@$remote_ip) {
' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue', debug sprintf
$device->ip, $n, $remote_type, $port; ' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue',
push @to_discover, [$n, $remote_type]; $device->ip, $n, $remote_type, $port;
push @to_discover, [$n, $remote_type];
}
} }
# set self as remote IP to suppress any further work # set self as remote IP to suppress any further work
@@ -679,10 +681,12 @@ sub store_neighbors {
} }
else { else {
# what we came here to do.... discover the neighbor # what we came here to do.... discover the neighbor
debug sprintf if (wantarray) {
' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue', debug sprintf
$device->ip, $remote_ip, $remote_type, $port; ' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue',
push @to_discover, [$remote_ip, $remote_type]; $device->ip, $remote_ip, $remote_type, $port;
push @to_discover, [$remote_ip, $remote_type];
}
$remote_port = $c_port->{$entry}; $remote_port = $c_port->{$entry};