Commit c3733b29 authored by Alex Brainman's avatar Alex Brainman

net: document why we do not use SO_REUSEADDR on windows

R=rsc, adg
CC=golang-dev
https://golang.org/cl/5302058
parent 704bf779
...@@ -11,6 +11,13 @@ import ( ...@@ -11,6 +11,13 @@ import (
) )
func setKernelSpecificSockopt(s syscall.Handle, f int) { 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. // Allow broadcast.
syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1) syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment