(req *http.Request, cc *ClientConn, reused bool)
| 37 | } |
| 38 | |
| 39 | func traceGotConn(req *http.Request, cc *ClientConn, reused bool) { |
| 40 | trace := httptrace.ContextClientTrace(req.Context()) |
| 41 | if trace == nil || trace.GotConn == nil { |
| 42 | return |
| 43 | } |
| 44 | ci := httptrace.GotConnInfo{Conn: cc.tconn} |
| 45 | ci.Reused = reused |
| 46 | cc.mu.Lock() |
| 47 | ci.WasIdle = len(cc.streams) == 0 && reused |
| 48 | if ci.WasIdle && !cc.lastActive.IsZero() { |
| 49 | ci.IdleTime = time.Now().Sub(cc.lastActive) |
| 50 | } |
| 51 | cc.mu.Unlock() |
| 52 | |
| 53 | trace.GotConn(ci) |
| 54 | } |
| 55 | |
| 56 | func traceWroteHeaders(trace *httptrace.ClientTrace) { |
| 57 | if trace != nil && trace.WroteHeaders != nil { |
no test coverage detected
searching dependent graphs…