diff --git a/rafthttp/pipeline.go b/rafthttp/pipeline.go index 4774c91b8..1f07f3e49 100644 --- a/rafthttp/pipeline.go +++ b/rafthttp/pipeline.go @@ -117,7 +117,7 @@ func (p *pipeline) post(data []byte) (err error) { req := createPostRequest(u, RaftPrefix, bytes.NewBuffer(data), "application/protobuf", p.tr.URLs, p.tr.ID, p.tr.ClusterID) done := make(chan struct{}, 1) - cancel := httputil.RequestCanceler(p.tr.pipelineRt, req) + cancel := httputil.RequestCanceler(req) go func() { select { case <-done: diff --git a/rafthttp/snapshot_sender.go b/rafthttp/snapshot_sender.go index d0c6c866d..3d73ac809 100644 --- a/rafthttp/snapshot_sender.go +++ b/rafthttp/snapshot_sender.go @@ -103,7 +103,7 @@ func (s *snapshotSender) send(merged snap.Message) { // post posts the given request. // It returns nil when request is sent out and processed successfully. func (s *snapshotSender) post(req *http.Request) (err error) { - cancel := httputil.RequestCanceler(s.tr.pipelineRt, req) + cancel := httputil.RequestCanceler(req) type responseAndError struct { resp *http.Response diff --git a/rafthttp/stream.go b/rafthttp/stream.go index 8f17bd97b..241797f4d 100644 --- a/rafthttp/stream.go +++ b/rafthttp/stream.go @@ -413,7 +413,7 @@ func (cr *streamReader) dial(t streamType) (io.ReadCloser, error) { return nil, fmt.Errorf("stream reader is stopped") default: } - cr.cancel = httputil.RequestCanceler(cr.tr.streamRt, req) + cr.cancel = httputil.RequestCanceler(req) cr.mu.Unlock() resp, err := cr.tr.streamRt.RoundTrip(req)