Source File
sock_linux.go
Belonging Package
net
// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package netimport ()// Linux stores the backlog as://// - uint16 in kernel version < 4.1,// - uint32 in kernel version >= 4.1//// Truncate number to avoid wrapping.//// See issue 5030 and 41470.func ( int) int {, := unix.KernelVersion():= 16if > 4 || ( == 4 && >= 1) {= 32}var uint = 1<< - 1if uint() > {= int()}return}func () int {, := open("/proc/sys/net/core/somaxconn")if != nil {return syscall.SOMAXCONN}defer .close(), := .readLine()if ! {return syscall.SOMAXCONN}:= getFields(), , := dtoi([0])if == 0 || ! {return syscall.SOMAXCONN}if > 1<<16-1 {return maxAckBacklog()}return}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |