_reuseport.go raw

   1  // +build !windows
   2  
   3  package transport
   4  
   5  import (
   6  	"syscall"
   7  )
   8  
   9  func reusePort(network, address string, conn syscall.RawConn) (e error) {
  10  	return conn.Control(func(descriptor uintptr) {
  11  		e := syscall.SetsockoptInt(int(descriptor), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
  12  		if e != nil {
  13  		}
  14  	},
  15  	)
  16  }
  17