]> Cypherpunks repositories - gostls13.git/commitdiff
net/rpc: listen on localhost, let kernel pick port
authorRuss Cox <rsc@golang.org>
Wed, 8 Oct 2014 03:08:07 +0000 (23:08 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 8 Oct 2014 03:08:07 +0000 (23:08 -0400)
This avoids a pop-up box on OS X and it avoids
a test failure if something is using 5555.
I apologize for not noticing this during the review.

TBR=r
CC=golang-codereviews
https://golang.org/cl/152320044

src/net/rpc/client_test.go

index c138c06b8d33cb4303b20a2d34143078f10bb7d8..d116d2acc9aa29ec74a93ba15201c2cf31d6c379 100644 (file)
@@ -63,13 +63,13 @@ func TestGobError(t *testing.T) {
        }()
        Register(new(S))
 
-       listen, err := net.Listen("tcp", ":5555")
+       listen, err := net.Listen("tcp", "127.0.0.1:0")
        if err != nil {
                panic(err)
        }
        go Accept(listen)
 
-       client, err := Dial("tcp", ":5555")
+       client, err := Dial("tcp", listen.Addr().String())
        if err != nil {
                panic(err)
        }