mirror of
https://github.com/golang/go
synced 2024-11-22 03:44:39 -07:00
net: disable wild use of SO_REUSEPORT on BSD variants
Fixes #2830 (again). R=rsc CC=golang-dev https://golang.org/cl/5651083
This commit is contained in:
parent
8040f9bb86
commit
6fa2296e83
@ -34,14 +34,6 @@ func setDefaultListenerSockopts(s int) error {
|
||||
if err != nil {
|
||||
return os.NewSyscallError("setsockopt", err)
|
||||
}
|
||||
// Allow reuse of recently-used ports.
|
||||
// This option is supported only in descendants of 4.4BSD,
|
||||
// to make an effective multicast application and an application
|
||||
// that requires quick draw possible.
|
||||
err = syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1)
|
||||
if err != nil {
|
||||
return os.NewSyscallError("setsockopt", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -52,6 +44,10 @@ func setDefaultMulticastSockopts(s int) error {
|
||||
if err != nil {
|
||||
return os.NewSyscallError("setsockopt", err)
|
||||
}
|
||||
// Allow reuse of recently-used ports.
|
||||
// This option is supported only in descendants of 4.4BSD,
|
||||
// to make an effective multicast application that requires
|
||||
// quick draw possible.
|
||||
err = syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1)
|
||||
if err != nil {
|
||||
return os.NewSyscallError("setsockopt", err)
|
||||
|
Loading…
Reference in New Issue
Block a user