Merge pull request #11545 from cpuguy83/remove_allocator_warning

Don't warn when ip_local_port_range not found
This commit is contained in:
Jessie Frazelle 2015-03-23 14:19:57 -07:00
Родитель d852e5fde8 8e4d9f3cf9
Коммит ccd4181d10
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -79,10 +79,11 @@ func NewErrPortAlreadyAllocated(ip string, port int) ErrPortAlreadyAllocated {
func init() {
const portRangeKernelParam = "/proc/sys/net/ipv4/ip_local_port_range"
portRangeFallback := fmt.Sprintf("using fallback port range %d-%d", beginPortRange, endPortRange)
file, err := os.Open(portRangeKernelParam)
if err != nil {
log.Warnf("Failed to read %s kernel parameter: %v", portRangeKernelParam, err)
log.Warnf("port allocator - %s due to error: %v", portRangeFallback, err)
return
}
var start, end int
@ -91,7 +92,7 @@ func init() {
if err == nil {
err = fmt.Errorf("unexpected count of parsed numbers (%d)", n)
}
log.Errorf("Failed to parse port range from %s: %v", portRangeKernelParam, err)
log.Errorf("port allocator - failed to parse system ephemeral port range from %s - %s: %v", portRangeKernelParam, portRangeFallback, err)
return
}
beginPortRange = start