File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -1251,19 +1251,15 @@ func (r *Request) TraceInfo() TraceInfo {
12511251 RequestAttempt : r .Attempt ,
12521252 }
12531253
1254- // Calculate the total time accordingly,
1255- // when connection is reused
1256- var requestStartTime time.Time
1257- if ct .gotConnInfo .Reused {
1254+ // Calculate the total time accordingly when connection is reused,
1255+ // and DNS start and get conn time may be zero if the request is invalid.
1256+ // See issue #1016.
1257+ requestStartTime := r .Time
1258+ if ct .gotConnInfo .Reused && ! ct .getConn .IsZero () {
12581259 requestStartTime = ct .getConn
1259- } else {
1260+ } else if ! ct . dnsStart . IsZero () {
12601261 requestStartTime = ct .dnsStart
12611262 }
1262- // DNS start and get conn time may be zero if the request is invalid.
1263- // See issue #1016.
1264- if requestStartTime .IsZero () {
1265- requestStartTime = r .Time
1266- }
12671263 ti .TotalTime = ct .endTime .Sub (requestStartTime )
12681264
12691265 // Only calculate on successful connections
You can’t perform that action at this time.
0 commit comments