X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy.pm;h=bfd593ca5ec497d45bbacc49696db9b0c446595f;hp=3e93b476d48d7129225275314b32909f3d9281a3;hb=f235dd11944d33e51c66b0fd30afc9582e292825;hpb=9b3b58e46da3867cabcc6a6c54442ea2e6431f9a diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 3e93b47..bfd593c 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,3 @@ -# $Id: IRSpy.pm,v 1.90 2008-07-16 11:42:13 mike Exp $ package ZOOM::IRSpy; @@ -26,6 +25,7 @@ our $VERSION = '1.02'; our $irspy_to_zeerex_xsl = dirname(__FILE__) . '/../../xsl/irspy2zeerex.xsl'; our $debug = 0; our $xslt_max_depth = 250; +our $max_timeout_errors = 3; # Enumeration for callback functions to return @@ -116,6 +116,16 @@ sub new { return $this; } +# wrapper to read the IRSpy database name from environment variable / apache config +sub connect_to_registry { + my %args = @_; + + # XXX: we could also handle her: user, password, elementSetName + + my $database = $ENV{IRSpyDbName} || "localhost:8018/IR-Explain---1"; + + return $database; +} sub log { my $this = shift(); @@ -433,6 +443,7 @@ sub check { while (1) { my @copy_conn = @conn; # avoid alias problems after splice() my $nconn = scalar(@copy_conn); + foreach my $i0 (0 .. $#copy_conn) { my $conn = $copy_conn[$i0]; #print "connection $i0 of $nconn/", scalar(@conn), " is $conn\n"; @@ -449,6 +460,10 @@ sub check { $conn->log("irspy_test", "checking for next test after '$address'"); $nextaddr = $this->_next_test($address); + if ($nextaddr && $conn->record->zoom_error->{TIMEOUT} >= $max_timeout_errors) { + $conn->log("irspy", "Got to many timeouts, stop testing: " . $conn->record->zoom_error->{TIMEOUT}); + $nextaddr = ""; + } } if (!defined $nextaddr) { $conn->log("irspy", "has no more tests: removing");