summaryrefslogtreecommitdiff
path: root/libgo/go/net/sockopt_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/net/sockopt_linux.go')
-rw-r--r--libgo/go/net/sockopt_linux.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/libgo/go/net/sockopt_linux.go b/libgo/go/net/sockopt_linux.go
index 67c1dc87a7a..7509c29eecf 100644
--- a/libgo/go/net/sockopt_linux.go
+++ b/libgo/go/net/sockopt_linux.go
@@ -18,23 +18,20 @@ func setDefaultSockopts(s, f, t int) error {
// Note that some operating systems never admit this option.
syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, 0)
}
-
- if f == syscall.AF_UNIX ||
- (f == syscall.AF_INET || f == syscall.AF_INET6) && t == syscall.SOCK_STREAM {
- // Allow reuse of recently-used addresses.
- err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
- if err != nil {
- return os.NewSyscallError("setsockopt", err)
- }
-
- }
-
// Allow broadcast.
err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)
if err != nil {
return os.NewSyscallError("setsockopt", err)
}
+ return nil
+}
+func setDefaultListenerSockopts(s int) error {
+ // Allow reuse of recently-used addresses.
+ err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
+ if err != nil {
+ return os.NewSyscallError("setsockopt", err)
+ }
return nil
}