Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1287)

Side by Side Diff: src/pkg/net/sock_bsd.go

Issue 5011046: code review 5011046: build: add build comments to core packages (Closed)
Patch Set: diff -r a12d99eb48bb https://go.googlecode.com/hg Created 12 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/net/sock.go ('k') | src/pkg/net/tcpsock_posix.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin freebsd
6
5 // Sockets for BSD variants 7 // Sockets for BSD variants
6 8
7 package net 9 package net
8 10
9 import ( 11 import (
10 "syscall" 12 "syscall"
11 ) 13 )
12 14
13 func setKernelSpecificSockopt(s, f int) { 15 func setKernelSpecificSockopt(s, f int) {
14 // Allow reuse of recently-used addresses. 16 // Allow reuse of recently-used addresses.
15 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1) 17 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
16 18
17 // Allow reuse of recently-used ports. 19 // Allow reuse of recently-used ports.
18 // This option is supported only in descendants of 4.4BSD, 20 // This option is supported only in descendants of 4.4BSD,
19 // to make an effective multicast application and an application 21 // to make an effective multicast application and an application
20 // that requires quick draw possible. 22 // that requires quick draw possible.
21 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1) 23 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1)
22 24
23 // Allow broadcast. 25 // Allow broadcast.
24 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1) 26 syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)
25 27
26 if f == syscall.AF_INET6 { 28 if f == syscall.AF_INET6 {
27 // using ip, tcp, udp, etc. 29 // using ip, tcp, udp, etc.
28 // allow both protocols even if the OS default is otherwise. 30 // allow both protocols even if the OS default is otherwise.
29 syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ON LY, 0) 31 syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ON LY, 0)
30 } 32 }
31 } 33 }
OLDNEW
« no previous file with comments | « src/pkg/net/sock.go ('k') | src/pkg/net/tcpsock_posix.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b