projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
put in temp fix for pc10 talk crashes
[spider.git]
/
perl
/
RouteDB.pm
diff --git
a/perl/RouteDB.pm
b/perl/RouteDB.pm
index c9c01ff4544565ea80651a35f78fb0dcd4526622..8059b08d5f92ee9ecf194ec87ef5172947af8fd4 100644
(file)
--- a/
perl/RouteDB.pm
+++ b/
perl/RouteDB.pm
@@
-13,25
+13,21
@@
#
# Copyright (c) 2004 Dirk Koopman G1TLH
#
#
# Copyright (c) 2004 Dirk Koopman G1TLH
#
-#
$Id$
+#
#
package RouteDB;
use DXDebug;
use DXChannel;
#
package RouteDB;
use DXDebug;
use DXChannel;
+use DXUtil;
use Prefix;
use strict;
use Prefix;
use strict;
-use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
-
use vars qw(%list %valid $default);
use vars qw(%list %valid $default);
+
%list = ();
$default = 99; # the number of hops to use if we don't know
%valid = (
%list = ();
$default = 99; # the number of hops to use if we don't know
%valid = (
@@
-90,7
+86,7
@@
sub update
my $interface = shift;
my $hops = shift || $default;
my $ref = $list{$call} || RouteDB->new($call);
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;
$iref->{count}++;
$iref->{hops} = $hops if $hops < $iref->{hops};
$iref->{t} = shift || $main::systime;
@@
-106,6
+102,14
@@
sub delete
delete $ref->{item}->{$interface} if $ref;
}
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
#
#
# generic AUTOLOAD for accessors
#
@@
-134,7
+138,8
@@
sub new
{
my $pkg = shift;
my $call = shift;
{
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;
}
1;