From f19277afe8d9c10b40b64c076ea816cce1010cc9 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 25 Jul 2012 20:19:20 +0000 Subject: [PATCH] Rework pulling packets off the socket, less delay in moving data to a more stable data structure git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13346 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/IPMI.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 30c963c38..460b906dc 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -391,8 +391,20 @@ sub waitforrsp { if ($select->can_read($timeout)) { while ($select->can_read(0)) { - $peerport = $socket->recv($data,1500,0); - route_ipmiresponse($peerport,unpack("C*",$data)); + my @ipmiq=(); + while ($select->can_read(0)) { + $peerport = $socket->recv($data,1500,0); + push @ipmiq,[$peerport,$data]; + } + while (@ipmiq) { + my $datagram = shift @ipmiq; + ($peerport,$data) = @$datagram; + route_ipmiresponse($peerport,unpack("C*",$data)); + while ($select->can_read(0)) { + $peerport = $socket->recv($data,1500,0); + push @ipmiq,[$peerport,$data]; + } + } } } return scalar (keys %sessions_waiting); @@ -401,7 +413,7 @@ sub waitforrsp { sub timedout { my $self = shift; $self->{timeout} = $self->{timeout}+1; - if ($self->{timeout} > 4) { #giveup, really + if ($self->{timeout} > 5) { #giveup, really $self->{timeout}=2; my $rsp={}; $rsp->{error} = "timeout";