https://github.com/coreos/etcd
Raw File
Tip revision: 85b640cee793e25f3837c47200089d14a8392dc7 authored by Benjamin Wang on 15 September 2022, 00:46:22 UTC
Bump version to 3.4.21
Tip revision: 85b640c
cancelreq.go
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// borrowed from golang/net/context/ctxhttp/cancelreq.go

package client

import "net/http"

func requestCanceler(tr CancelableTransport, req *http.Request) func() {
	ch := make(chan struct{})
	req.Cancel = ch

	return func() {
		close(ch)
	}
}
back to top