]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix utp.Socket leak in test
authorMatt Joiner <anacrolix@gmail.com>
Mon, 3 Aug 2015 14:48:17 +0000 (00:48 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 3 Aug 2015 14:48:17 +0000 (00:48 +1000)
client_test.go

index 7bc9756c063a81d653980ff4f93585bd8d2d373c..bb4fc36154fc7f7ce081fd1c5c283faf67322150 100644 (file)
@@ -160,10 +160,9 @@ func TestUTPRawConn(t *testing.T) {
                }
        }()
        // Connect a UTP peer to see if the RawConn will still work.
-       utpPeer, err := func() *utp.Socket {
-               s, _ := utp.NewSocket("")
-               return s
-       }().Dial(fmt.Sprintf("localhost:%d", util.AddrPort(l.Addr())))
+       s, _ := utp.NewSocket("")
+       defer s.Close()
+       utpPeer, err := s.Dial(fmt.Sprintf("localhost:%d", missinggo.AddrPort(l.Addr())))
        if err != nil {
                t.Fatalf("error dialing utp listener: %s", err)
        }