mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: fix httputil.RequestCanceler
This commit is contained in:
parent
ae4b4109b2
commit
0503676bde
@ -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)
|
req := createPostRequest(u, RaftPrefix, bytes.NewBuffer(data), "application/protobuf", p.tr.URLs, p.tr.ID, p.tr.ClusterID)
|
||||||
|
|
||||||
done := make(chan struct{}, 1)
|
done := make(chan struct{}, 1)
|
||||||
cancel := httputil.RequestCanceler(p.tr.pipelineRt, req)
|
cancel := httputil.RequestCanceler(req)
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -103,7 +103,7 @@ func (s *snapshotSender) send(merged snap.Message) {
|
|||||||
// post posts the given request.
|
// post posts the given request.
|
||||||
// It returns nil when request is sent out and processed successfully.
|
// It returns nil when request is sent out and processed successfully.
|
||||||
func (s *snapshotSender) post(req *http.Request) (err error) {
|
func (s *snapshotSender) post(req *http.Request) (err error) {
|
||||||
cancel := httputil.RequestCanceler(s.tr.pipelineRt, req)
|
cancel := httputil.RequestCanceler(req)
|
||||||
|
|
||||||
type responseAndError struct {
|
type responseAndError struct {
|
||||||
resp *http.Response
|
resp *http.Response
|
||||||
|
@ -413,7 +413,7 @@ func (cr *streamReader) dial(t streamType) (io.ReadCloser, error) {
|
|||||||
return nil, fmt.Errorf("stream reader is stopped")
|
return nil, fmt.Errorf("stream reader is stopped")
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
cr.cancel = httputil.RequestCanceler(cr.tr.streamRt, req)
|
cr.cancel = httputil.RequestCanceler(req)
|
||||||
cr.mu.Unlock()
|
cr.mu.Unlock()
|
||||||
|
|
||||||
resp, err := cr.tr.streamRt.RoundTrip(req)
|
resp, err := cr.tr.streamRt.RoundTrip(req)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user