X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy.pm;h=f8150b1700e995abf3e54418b9f8e81784d66dd4;hb=6630d9e88e68aa87c0c27ea58c3b11140480891d;hp=8e6d3acdb6b56b75d3a2fde7747556e091341302;hpb=a872bfd36956697679ac33140503268b57d7aa07;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 8e6d3ac..f8150b1 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.88 2007-09-18 16:57:37 mike Exp $ +# $Id: IRSpy.pm,v 1.90 2008-07-16 11:42:13 mike Exp $ package ZOOM::IRSpy; @@ -230,6 +230,7 @@ sub _next_connection { my $i = $this->{modi}; if (!defined $n) { $target = shift @{ $this->{queue} }; + return undef if !defined $target; } else { while (1) { $target = shift @{ $this->{queue} }; @@ -237,10 +238,11 @@ sub _next_connection { my $h = _hash($target); my $hmodn = $h % $n; last if $hmodn == $i; - $this->log("irspy", "'$target' hash $h % $n = $hmodn != $i"); + #$this->log("irspy", "'$target' hash $h % $n = $hmodn != $i"); } } + die "oops -- target is undefined" if !defined $target; return create ZOOM::IRSpy::Connection($this, $target, async => 1, timeout => $this->{timeout}); } @@ -260,7 +262,9 @@ sub _hash { sub _irspy_to_zeerex { my $this = shift(); - my($conn, $save_xml) = @_; + my($conn) = @_; + + my $save_xml = $ENV{IRSPY_SAVE_XML}; my $irspy_doc = $conn->record()->{zeerex}->ownerDocument; if ($save_xml) { @@ -284,12 +288,12 @@ sub _irspy_to_zeerex { } -sub _rewrite_record { +sub _rewrite_irspy_record { my $this = shift(); my($conn) = @_; $conn->log("irspy", "rewriting XML record"); - my $rec = $this->_irspy_to_zeerex($conn, $ENV{IRSPY_SAVE_XML}); + my $rec = $this->_irspy_to_zeerex($conn); # Since IRSpy can run for a long time between writes back to the # database, it's quite possible for the server to have closed the @@ -429,7 +433,7 @@ sub check { } if (!defined $nextaddr) { $conn->log("irspy", "has no more tests: removing"); - $this->_rewrite_record($conn); + $this->_rewrite_irspy_record($conn); $conn->option(rewrote_record => 1); my $newconn = $this->_next_connection(); if (!defined $newconn) {