mirror of https://github.com/hashicorp/consul
e8312d6b5a
Previously we believe it was necessary for all code that required ports to use freeport to prevent conflicts. https://github.com/dnephin/freeport-test shows that it is actually save to use port 0 (`127.0.0.1:0`) as long as it is passed directly to `net.Listen`, and the listener holds the port for as long as it is needed. This works because freeport explicitly avoids the ephemeral port range, and port 0 always uses that range. As you can see from the test output of https://github.com/dnephin/freeport-test, the two systems never use overlapping ports. This commit converts all uses of freeport that were being passed directly to a net.Listen to use port 0 instead. This allows us to remove a bit of wrapping we had around httptest, in a couple places. |
||
---|---|---|
.. | ||
decode | ||
file | ||
mutex | ||
retry | ||
routine | ||
semaphore | ||
serf | ||
stringslice | ||
template | ||
ttlcache | ||
cluster.go | ||
cluster_test.go | ||
eof.go | ||
eof_test.go | ||
json.go | ||
map_walker.go | ||
map_walker_test.go | ||
math.go | ||
math_test.go | ||
path.go | ||
rand.go | ||
rtt.go | ||
rtt_test.go | ||
stop_context.go | ||
stop_context_test.go | ||
telemetry.go | ||
telemetry_test.go | ||
translate.go | ||
translate_test.go | ||
useragent.go | ||
useragent_test.go | ||
uuid.go |