-# $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;
my $i = $this->{modi};
if (!defined $n) {
$target = shift @{ $this->{queue} };
+ return undef if !defined $target;
} else {
while (1) {
$target = shift @{ $this->{queue} };
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});
}
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) {
}
-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
# connection as idle. So re-establish it if necessary.
$this->{conn}->connect($conn->option("host"));
- _really_rewrite_record($this->{conn}, $rec);
+ _rewrite_zeerex_record($this->{conn}, $rec);
$conn->log("irspy", "rewrote XML record");
}
-sub _really_rewrite_record {
+sub _rewrite_zeerex_record {
my($conn, $rec, $oldid) = @_;
my $p = $conn->package();
}
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) {