-
Russ Cox authored
The old way to find a port was to listen :0 and then look at what port it picked, close the listener, and then immediately try to listen on that port. On some Windows 7 machines that sequence fails at the second listen, because the first one is still lingering in the TCP/IP stack somewhere. (Ironically, most of these are used in tests of a "second listen", which in this case ends up being the third listen.) Instead of this race, just return the listener from the function, replacing usableLocalPort+Listen with usableListenPort. Fixes #3219. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5769045
a385f38d