1
0
mirror of https://github.com/golang/go synced 2024-11-20 05:54:43 -07:00

net: document why we do not use SO_REUSEADDR on windows

R=rsc, adg
CC=golang-dev
https://golang.org/cl/5302058
This commit is contained in:
Alex Brainman 2011-10-26 22:25:20 +11:00
parent 704bf7791b
commit c3733b29d4

View File

@ -11,6 +11,13 @@ import (
)
func setKernelSpecificSockopt(s syscall.Handle, f int) {
// Windows will reuse recently-used addresses by default.
// SO_REUSEADDR should not be used here, as it allows
// a socket to forcibly bind to a port in use by another socket.
// This could lead to a non-deterministic behavior, where
// connection requests over the port cannot be guaranteed
// to be handled by the correct socket.
// Allow broadcast.
syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)