]> Cypherpunks repositories - gostls13.git/commitdiff
net: disable wild use of SO_REUSEPORT on BSD variants
authorMikio Hara <mikioh.mikioh@gmail.com>
Mon, 13 Feb 2012 03:45:59 +0000 (12:45 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Mon, 13 Feb 2012 03:45:59 +0000 (12:45 +0900)
Fixes #2830 (again).

R=rsc
CC=golang-dev
https://golang.org/cl/5651083

src/pkg/net/sockopt_bsd.go

index 519d2fb05a8dab01360105bf5696c0b7bcd836c3..79e0e57e21ee49634128484a384f1f2ae9d947f9 100644 (file)
@@ -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)