mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
Merge pull request #6375 from watson6282/net-core-rmem_max
Reduce maximum socket buffer size so select works
This commit is contained in:
commit
06eb179a8b
@ -64,6 +64,11 @@ sub dodiscover {
|
||||
my $sysctl;
|
||||
open($sysctl, "<", "/proc/sys/net/core/rmem_max");
|
||||
my $maxrcvbuf = <$sysctl>;
|
||||
# select() on a socket will never succeed if the buffer is too large (i.e. near INT_MAX)
|
||||
my $cap_maxrcvbuf = 2047*1024*1024;
|
||||
if ($maxrcvbuf > $cap_maxrcvbuf) {
|
||||
$maxrcvbuf = $cap_maxrcvbuf;
|
||||
}
|
||||
my $rcvbuf = $args{'socket'}->sockopt(SO_RCVBUF);
|
||||
if ($maxrcvbuf > $rcvbuf) {
|
||||
$args{'socket'}->sockopt(SO_RCVBUF, $maxrcvbuf / 2);
|
||||
|
@ -209,6 +209,11 @@ sub new {
|
||||
my $sysctl;
|
||||
open($sysctl, "<", "/proc/sys/net/core/rmem_max");
|
||||
my $maxrcvbuf = <$sysctl>;
|
||||
# select() on a socket will never succeed if the buffer is too large (i.e. near INT_MAX)
|
||||
my $cap_maxrcvbuf = 2047*1024*1024;
|
||||
if ($maxrcvbuf > $cap_maxrcvbuf) {
|
||||
$maxrcvbuf = $cap_maxrcvbuf;
|
||||
}
|
||||
my $rcvbuf = $socket->sockopt(SO_RCVBUF);
|
||||
if ($maxrcvbuf > $rcvbuf) {
|
||||
$socket->sockopt(SO_RCVBUF, $maxrcvbuf / 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user