MCPcopy Create free account
hub / github.com/imroc/req / traceGotConn

Function traceGotConn

internal/http2/trace.go:39–54  ·  view source on GitHub ↗
(req *http.Request, cc *ClientConn, reused bool)

Source from the content-addressed store, hash-verified

37}
38
39func 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
56func traceWroteHeaders(trace *httptrace.ClientTrace) {
57 if trace != nil && trace.WroteHeaders != nil {

Callers 1

RoundTripOptMethod · 0.70

Calls 4

LockMethod · 0.80
IsZeroMethod · 0.80
UnlockMethod · 0.80
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…