From 6ddbbe050558b36323ae39bd387c1637342972dd Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 3 May 2012 09:48:32 +0000 Subject: [PATCH] Add support of lsslp -C -T git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12505 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/SLP.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/SLP.pm b/perl-xCAT/xCAT/SLP.pm index 3f17c5230..61cd75662 100644 --- a/perl-xCAT/xCAT/SLP.pm +++ b/perl-xCAT/xCAT/SLP.pm @@ -35,6 +35,7 @@ sub getmulticasthash { sub dodiscover { my %args = @_; + my $rspcount = 0; $xid = int(rand(16384))+1; unless ($args{'socket'}) { if ($ip6support) { @@ -82,7 +83,8 @@ sub dodiscover { $waitforsocket->add($args{'socket'}); my $retrytime = ($args{Retry}>0)?$args{Retry}+1:1; for(my $i = 0; $i < $retrytime; $i++){ - my $deadline=time()+3; + my $waittime = ($args{Time}>0)?$args{Time}:3; + my $deadline=time()+$waittime; while ($deadline > time()) { while ($waitforsocket->can_read(1)) { my $slppacket; @@ -116,7 +118,13 @@ sub dodiscover { $args{Callback}->($result); } } + $rspcount++; } + if ($args{Time} and $args{Count}) { + if ($rspcount >= $args{Count}) { + last; + } + } foreach my $srvtype (@srvtypes) { send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype); }