github.com/go-graphite/carbonapi@v0.17.0/cmd/carbonapi/helper/reuseport_linux.go (about)

     1  package helper
     2  
     3  import (
     4  	"syscall"
     5  
     6  	"golang.org/x/sys/unix"
     7  )
     8  
     9  func ReusePort(network, address string, conn syscall.RawConn) error {
    10  	return conn.Control(func(descriptor uintptr) {
    11  		_ = syscall.SetsockoptInt(int(descriptor), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1)
    12  	})
    13  }