X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FPing.pm;h=7f1d72247316124e0aa6f81203c50444626ded78;hb=377d1ce5071669cd2d5797f5604fd5e3034bfc51;hp=39a4ee78d2a8036353b8c4b471d59b4a6abb6674;hpb=0c63d7765f844186139d26db5f552fe36e10b94b;p=spider.git diff --git a/perl/Thingy/Ping.pm b/perl/Thingy/Ping.pm index 39a4ee78..7f1d7224 100644 --- a/perl/Thingy/Ping.pm +++ b/perl/Thingy/Ping.pm @@ -99,7 +99,7 @@ sub handle # it's a reply, look in the ping list for this one my $ref = $ping{$thing->{id}} if exists $thing->{id}; - $ref ||= $thing->find; + $ref ||= find($thing->{origin}, $thing->{group}); if ($ref) { my $t = tv_interval($ref->{t}, [ gettimeofday ]); if (my $dxc = DXChannel::get($ref->{user} || $ref->{origin})) { @@ -131,6 +131,7 @@ sub handle } } } + delete $ping{$ref->{id}}; } } } else { @@ -179,10 +180,17 @@ sub forget sub find { - my $call = shift; + my $to = shift; + my $from = shift; + my $user = shift; + foreach my $thing (values %ping) { - if (($thing->{user} || $thing->{origin}) eq $call) { - return $thing; + if ($thing->{origin} eq $from && $thing->{group} eq $to) { + if ($user) { + return if $thing->{user} && $thing->{user} eq $user; + } else { + return $thing; + } } } return undef;