fix deadlock in the transport's serve function
We don't close the connection before the echo hasn't returned, but echo won't
return before AcceptStream has returned an error, which only happens when the
connection is closed.
@@ -138,12 +138,12 @@ func serve(t *testing.T, l transport.Listener) {
if err != nil {
return
}
+ defer c.Close()
wg.Add(1)
debugLog(t, "accepted connection")
go func() {
defer wg.Done()
- defer c.Close()
echo(t, c)
}()
}
