Bring in some logic from IPMI plugin to get a better assurance of optimal receive buffer behavior

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11936 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-03-21 17:50:15 +00:00
parent 31fb9e555f
commit 9184142745

View File

@ -41,6 +41,16 @@ sub dodiscover {
} else {
$args{'socket'} = IO::Socket::INET->new(Proto => 'udp');
}
#make an extra effort to request biggest receive buffer OS is willing to give us
if (-r "/proc/sys/net/core/rmem_max") { # we can detect the maximum allowed socket, read it.
my $sysctl;
open ($sysctl,"<","/proc/sys/net/core/rmem_max");
my $maxrcvbuf=<$sysctl>;
my $rcvbuf = $socket->sockopt(SO_RCVBUF);
if ($maxrcvbuf > $rcvbuf) {
$socket->sockopt(SO_RCVBUF,$maxrcvbuf/2);
}
}
}
unless ($args{SrvTypes}) { croak "SrvTypes argument is required for xCAT::SLP::Dodiscover"; }
setsockopt($args{'socket'},SOL_SOCKET,SO_BROADCAST,1); #allow for broadcasts to be sent, we know what we are doing