From: miker Date: Thu, 20 Apr 2006 03:59:54 +0000 (+0000) Subject: smarter default "recv" X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=63429e6695745c01f6a9a8089a2ab375fd82909e;p=opensrf%2Fbjwebb.git smarter default "recv" git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@697 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/AppSession.pm b/src/perlmods/OpenSRF/AppSession.pm index 9f5099a..caf6b05 100644 --- a/src/perlmods/OpenSRF/AppSession.pm +++ b/src/perlmods/OpenSRF/AppSession.pm @@ -709,11 +709,17 @@ sub recv { $logger->debug( ref($self) ."->recv with timeout " . $args{timeout}, INTERNAL ); } - $args{count} ||= 1; - my $avail = @{ $self->{recv_queue} }; $self->{remaining_recv_timeout} = $self->{recv_timeout}; + if (!$args{count}) { + if (wantarray) { + $args{count} = $avail; + } else { + $args{count} = 1; + } + } + while ( $self->{remaining_recv_timeout} > 0 and $avail < $args{count} ) { last if $self->complete; my $starttime = time;