summaryrefslogtreecommitdiff
path: root/libgo/go/net/sockopt_bsd.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-02 16:38:43 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-02 16:38:43 +0000
commit2d2d80b8bd963f59534897b3d51ef8bd546cb4bc (patch)
treeefa0c55763b34cbc633bc494c2743d1b5d9aaff3 /libgo/go/net/sockopt_bsd.go
parent2ad2700dbf70b2e49575f3f2307839a45cf2f71c (diff)
downloadgcc-2d2d80b8bd963f59534897b3d51ef8bd546cb4bc.tar.gz
libgo: Update to weekly.2012-02-14 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/sockopt_bsd.go')
-rw-r--r--libgo/go/net/sockopt_bsd.go31
1 files changed, 12 insertions, 19 deletions
diff --git a/libgo/go/net/sockopt_bsd.go b/libgo/go/net/sockopt_bsd.go
index bc764650627..79e0e57e21e 100644
--- a/libgo/go/net/sockopt_bsd.go
+++ b/libgo/go/net/sockopt_bsd.go
@@ -20,31 +20,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 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)
- }
- }
-
// 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
}
@@ -55,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)