client.go | 13 +++++++++++-- diff --git a/client.go b/client.go index a3d6fca466c3b54d8916d8271ceed0b9d322c007..85b78c4cae1e0190df3b3d72abe1c9078e48580c 100644 --- a/client.go +++ b/client.go @@ -505,7 +505,17 @@ return ok } // Returns a connection over UTP or TCP, whichever is first to connect. -func (cl *Client) dialFirst(ctx context.Context, addr string) dialResult { +func (cl *Client) dialFirst(ctx context.Context, addr string) (res dialResult) { + { + t := perf.NewTimer(perf.CallerName(0)) + defer func() { + if res.Conn == nil { + t.Mark(fmt.Sprintf("returned no conn (context: %v)", ctx.Err())) + } else { + t.Mark("returned conn over " + res.Network) + } + }() + } ctx, cancel := context.WithCancel(ctx) // As soon as we return one connection, cancel the others. defer cancel() @@ -532,7 +542,6 @@ }() return true }) }() - var res dialResult // Wait for a successful connection. func() { defer perf.ScopeTimer()()