X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRouteDB.pm;h=96d0b0b4691a690c6d13d647040c67b108e759f1;hb=aeb4c8591de710bd8de14f33817d2f0aabbd5e28;hp=c9c01ff4544565ea80651a35f78fb0dcd4526622;hpb=611e9ea5204765638eceecbd8e1dd04a4f10a1be;p=spider.git diff --git a/perl/RouteDB.pm b/perl/RouteDB.pm index c9c01ff4..96d0b0b4 100644 --- a/perl/RouteDB.pm +++ b/perl/RouteDB.pm @@ -90,7 +90,7 @@ sub update my $interface = shift; my $hops = shift || $default; my $ref = $list{$call} || RouteDB->new($call); - my $iref = $ref->{item}->{$interface} ||= RouteDB::Item->new($interface); + my $iref = $ref->{item}->{$interface} ||= RouteDB::Item->new($interface, $hops); $iref->{count}++; $iref->{hops} = $hops if $hops < $iref->{hops}; $iref->{t} = shift || $main::systime; @@ -106,6 +106,14 @@ sub delete delete $ref->{item}->{$interface} if $ref; } +sub delete_interface +{ + my $interface = shift; + foreach my $ref (values %list) { + delete $ref->{item}->{$interface}; + } +} + # # generic AUTOLOAD for accessors # @@ -134,7 +142,8 @@ sub new { my $pkg = shift; my $call = shift; - return bless {call => $call, hops => $RouteDB::default}, (ref $pkg || $pkg); + my $hops = shift || $RouteDB::default; + return bless {call => $call, hops => $hops}, (ref $pkg || $pkg); } 1;