From 63429e6695745c01f6a9a8089a2ab375fd82909e Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 20 Apr 2006 03:59:54 +0000 Subject: [PATCH] smarter default "recv" git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@697 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/AppSession.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.11.0