X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FPod.pm;h=f24157b68f533add6116fc97eaea11d6575ecaed;hp=e338459b586e87a5732fe28ad00ec9a4fdf9403d;hb=b246f78aede100aba0dd50576a90298465acd634;hpb=1c872700aed472f8411c8b4fb6fb72fdb5986097 diff --git a/lib/ZOOM/Pod.pm b/lib/ZOOM/Pod.pm index e338459..f24157b 100644 --- a/lib/ZOOM/Pod.pm +++ b/lib/ZOOM/Pod.pm @@ -1,4 +1,4 @@ -# $Id: Pod.pm,v 1.15 2006-07-18 13:45:36 mike Exp $ +# $Id: Pod.pm,v 1.17 2006-07-21 11:25:43 mike Exp $ package ZOOM::Pod; @@ -228,8 +228,8 @@ have one search active on it at a time: this allows the pod to maintain the one-to-one mapping between connections and result-sets. Submitting a new search on a connection before the old one has completed will result in a total failure in the nature of causality, -and the spontaneous existence-failure of the universe. Do not do -this. +and the spontaneous existence-failure of the universe. Try to avoid +doing this too often. =cut @@ -238,7 +238,9 @@ sub search_pqf { my($pqf) = @_; foreach my $i (0..@{ $this->{conn} }-1) { - $this->{rs}->[$i] = $this->{conn}->[$i]->search_pqf($pqf); + my $conn = $this->{conn}->[$i]; + $this->{rs}->[$i] = $conn->search_pqf($pqf) + if !$conn->option("pod_omit"); } } @@ -277,21 +279,28 @@ sub wait { my $res = 0; - my(@conn, @imap); - foreach my $i (0 .. @{ $this->{conn} }-1) { - my $conn = $this->{conn}->[$i]; - if (!$conn->option("pod_omit")) { - push @conn, $conn; - } else { - # If we don't push anything onto @conn, then the index $i - # will be meaningless in the loop below, and the - # references to $rs[$i] will be wrong. Ouch. - push @conn, undef; + while (1) { + my @conn; + my @idxmap; # maps indexes into conn to global indexes + foreach my $i (0 .. @{ $this->{conn} }-1) { + my $conn = $this->{conn}->[$i]; + if ($conn->option("pod_omit")) { + #ZOOM::Log::log("pod", "connection $i omitted (", + #$conn->option("host"), ")"); + } else { + push @conn, $conn; + push @idxmap, $i; + #ZOOM::Log::log("pod", "connection $i included (", + #$conn->option("host"), ")"); + } } - } - while ((my $i = ZOOM::event(\@conn)) != 0) { - my $conn = $conn[$i-1]; + my $i0 = ZOOM::event(\@conn); + last if $i0 == 0; + my $i = 1+$idxmap[$i0-1]; + my $conn = $this->{conn}->[$i-1]; + die "connection-mapping screwup" if $conn ne $conn[$i0-1]; + my $ev = $conn->last_event(); my $evstr = ZOOM::event_str($ev); ZOOM::Log::log("pod", "connection ", $i-1, ": event $ev ($evstr)");