From: Matt Joiner Date: Mon, 3 Aug 2015 14:48:17 +0000 (+1000) Subject: Fix utp.Socket leak in test X-Git-Tag: v1.0.0~1091 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8d581ce7f2a6bb242cbee167e2e4f863fd9a21b1;p=btrtrc.git Fix utp.Socket leak in test --- diff --git a/client_test.go b/client_test.go index 7bc9756c..bb4fc361 100644 --- a/client_test.go +++ b/client_test.go @@ -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) }