projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
delete successful pings
[spider.git]
/
perl
/
Thingy
/
Ping.pm
diff --git
a/perl/Thingy/Ping.pm
b/perl/Thingy/Ping.pm
index ce64181231f146401fae09827efda789ca789c87..7f1d72247316124e0aa6f81203c50444626ded78 100644
(file)
--- a/
perl/Thingy/Ping.pm
+++ b/
perl/Thingy/Ping.pm
@@
-98,17
+98,18
@@
sub handle
} else {
# it's a reply, look in the ping list for this one
} else {
# it's a reply, look in the ping list for this one
- my $ref = $ping{$thing->{id}} || $thing->find;
+ my $ref = $ping{$thing->{id}} if exists $thing->{id};
+ $ref ||= find($thing->{origin}, $thing->{group});
if ($ref) {
if ($ref) {
- my $t = tv_interval($
thing
->{t}, [ gettimeofday ]);
- if (my $dxc = DXChannel::get($
thing->{user} || $thing
->{origin})) {
+ my $t = tv_interval($
ref
->{t}, [ gettimeofday ]);
+ if (my $dxc = DXChannel::get($
ref->{user} || $ref
->{origin})) {
- my $tochan = DXChannel::get($
thing->{touser} || $thing
->{group});
+ my $tochan = DXChannel::get($
ref->{touser} || $ref
->{group});
if ($dxc->is_user) {
my $s = sprintf "%.2f", $t;
my $ave = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t;
if ($dxc->is_user) {
my $s = sprintf "%.2f", $t;
my $ave = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t;
- $dxc->send($dxc->msg('pingi',
($thing->{touser} || $thing->{group})
, $s, $ave))
+ $dxc->send($dxc->msg('pingi',
$ref->{user}
, $s, $ave))
} elsif ($dxc->is_node) {
if ($tochan ) {
my $nopings = $tochan->user->nopings || $DXProt::obscount;
} elsif ($dxc->is_node) {
if ($tochan ) {
my $nopings = $tochan->user->nopings || $DXProt::obscount;
@@
-130,6
+131,7
@@
sub handle
}
}
}
}
}
}
+ delete $ping{$ref->{id}};
}
}
} else {
}
}
} else {
@@
-178,10
+180,17
@@
sub forget
sub find
{
sub find
{
- my $call = shift;
+ my $to = shift;
+ my $from = shift;
+ my $user = shift;
+
foreach my $thing (values %ping) {
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;
}
}
return undef;