diff --git a/xray/client_test.go b/xray/client_test.go index 00fc1eb7..58be9d28 100644 --- a/xray/client_test.go +++ b/xray/client_test.go @@ -279,49 +279,6 @@ func TestRoundTripReuseDatarace(t *testing.T) { wg.Wait() } -func TestRoundTripReuseTLSDatarace(t *testing.T) { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - b := []byte(`200 - Nothing to see`) - w.WriteHeader(http.StatusOK) - w.Write(b) - })) - defer ts.Close() - - certpool := x509.NewCertPool() - certpool.AddCert(ts.Certificate()) - tr := &http.Transport{ - TLSClientConfig: &tls.Config{ - RootCAs: certpool, - }, - } - rt := &roundtripper{ - Base: tr, - } - - wg := sync.WaitGroup{} - n := 30 - wg.Add(n) - for i := 0; i < n; i++ { - go func() { - defer wg.Done() - reader := strings.NewReader("") - ctx, root := BeginSegment(context.Background(), "Test") - req, _ := http.NewRequest("GET", ts.URL, reader) - req = req.WithContext(ctx) - res, err := rt.RoundTrip(req) - assert.NoError(t, err) - ioutil.ReadAll(res.Body) - res.Body.Close() // make net/http/transport.go connection reuse - root.Close(nil) - }() - } - for i := 0; i < n; i++ { - _, e := TestDaemon.Recv() - assert.NoError(t, e) - } - wg.Wait() -} - func TestRoundTripHttp2Datarace(t *testing.T) { ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { b := []byte(`200 - Nothing to see`) diff --git a/xray/httptrace.go b/xray/httptrace.go index c56c40fa..ac66a851 100644 --- a/xray/httptrace.go +++ b/xray/httptrace.go @@ -97,7 +97,7 @@ func (xt *HTTPSubsegments) ConnectDone(network, addr string, err error) { // TLSHandshakeStart begins a tls subsegment if the HTTP operation // subsegment is still in progress. func (xt *HTTPSubsegments) TLSHandshakeStart() { - if GetSegment(xt.opCtx).safeInProgress() && xt.connCtx != nil { + if GetSegment(xt.opCtx).safeInProgress() { xt.tlsCtx, _ = BeginSubsegment(xt.connCtx, "tls") } }