Merge pull request #7617 from mxpv/ctr-fix

Fix ctr crash when pulling with --http-dump and --http-trace simultaneously
This commit is contained in:
Kazuyoshi Kato
2022-11-02 07:58:18 -07:00
committed by GitHub

View File

@@ -200,7 +200,12 @@ func NewDebugClientTrace(ctx gocontext.Context) *httptrace.ClientTrace {
}
},
GotConn: func(connInfo httptrace.GotConnInfo) {
log.G(ctx).WithField("reused", connInfo.Reused).WithField("remote_addr", connInfo.Conn.RemoteAddr().String()).Debugf("Connection successful")
remoteAddr := "<nil>"
if addr := connInfo.Conn.RemoteAddr(); addr != nil {
remoteAddr = addr.String()
}
log.G(ctx).WithField("reused", connInfo.Reused).WithField("remote_addr", remoteAddr).Debugf("Connection successful")
},
}
}