X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FTest%2FPing.pm;h=3b88e34ae50de83c8e4f3e208451112298af6f90;hb=20ea7e9bd29c412ee300e13e0da93f8298f45b6f;hp=e2c7665e285d0cf3c20a99d7c86e6cfa4c876dc2;hpb=81ce14d9106ce170dff26db630e2b56edf86e5d8;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Test/Ping.pm b/lib/ZOOM/IRSpy/Test/Ping.pm index e2c7665..3b88e34 100644 --- a/lib/ZOOM/IRSpy/Test/Ping.pm +++ b/lib/ZOOM/IRSpy/Test/Ping.pm @@ -1,4 +1,4 @@ -# $Id: Ping.pm,v 1.10 2006-07-24 17:02:20 mike Exp $ +# $Id: Ping.pm,v 1.16 2006-11-29 18:18:37 mike Exp $ # See the "Main" test package for documentation @@ -9,20 +9,18 @@ use strict; use warnings; use ZOOM::IRSpy::Test; -our @ISA; -@ISA = qw(ZOOM::IRSpy::Test); +our @ISA = qw(ZOOM::IRSpy::Test); +use ZOOM::IRSpy::Utils qw(isodate); -sub run { - my $this = shift(); - my $irspy = $this->irspy(); - my $pod = $irspy->pod(); - $pod->callback(ZOOM::Event::CONNECT, \&connected); - $pod->callback("exception", \¬_connected); - my $err = $pod->wait($irspy); +sub start { + my $class = shift(); + my($conn) = @_; - return 0; + $conn->irspy_connect(undef, {}, + ZOOM::Event::CONNECT, \&connected, + exception => \¬_connected); } @@ -30,15 +28,14 @@ sub connected { maybe_connected(@_, 1) } sub not_connected { maybe_connected(@_, 0) } sub maybe_connected { - my($conn, $irspy, $rs, $event, $ok) = @_; + my($conn, $task, $__UNUSED_udata, $event, $ok) = @_; - my $rec = $irspy->record($conn); - $irspy->log("irspy_test", $conn->option("host"), - ($ok ? "" : " not"), " connected"); + $conn->log("irspy_test", ($ok ? "" : "not "), "connected"); + my $rec = $conn->record(); $rec->append_entry("irspy:status", "" . - $irspy->isodate(time()) . ""); - $conn->option(pod_omit => 1) if !$ok; - return 0; + isodate(time()) . ""); + return $ok ? ZOOM::IRSpy::Status::TEST_GOOD : + ZOOM::IRSpy::Status::TEST_BAD; }