fix(testutil): fix FreeTCPAddr localhost usage (backport #18996) (#18999)

Co-authored-by: gluax <16431709+gluax@users.noreply.github.com>
This commit is contained in:
mergify[bot] 2024-01-10 09:08:21 +00:00 committed by GitHub
parent 7f1a2b31cb
commit fe4b58b2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,7 +220,7 @@ func writeFile(name, dir string, contents []byte) error {
// Get a free address for a test CometBFT server
// protocol is either tcp, http, etc
func FreeTCPAddr() (addr, port string, closeFn func() error, err error) {
l, err := net.Listen("tcp", "localhost:0")
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return "", "", nil, err
}