• Russ Cox's avatar
    net: never use backlog > 65535 · e64f3f21
    Russ Cox authored
    The system call takes an int, but the kernel stores it in a uint16.
    At least one Linux system sets /proc/sys/net/core/somaxconn
    to 262144, which ends up being 0 in the uint16. Avoid being tricked.
    
    FreeBSD sources also store the backlog in a uint16.
    Assume the problem is systemic and fix it everywhere.
    
    Fixes #5030.
    
    R=golang-dev, bradfitz
    CC=golang-dev
    https://golang.org/cl/7480046
    e64f3f21
sock_linux.go 648 Bytes