瀏覽代碼

http2: terminate await request cancel goroutine on conn close

If conn closes but the request cancel select is still blocked
we must close the connection wait channel.

Updates golang/go#24776 (needs bundle into std for fix)

Change-Id: I7e3ffdf2dd9b127727e24fe262b2f4c5d96fc184
Reviewed-on: https://go-review.googlesource.com/108415
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Mark Fischer 7 年之前
父節點
當前提交
5f9ae10d9a
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      http2/transport.go

+ 3 - 0
http2/transport.go

@@ -951,6 +951,9 @@ func (cc *ClientConn) awaitOpenSlotForRequest(req *http.Request) error {
 	for {
 		cc.lastActive = time.Now()
 		if cc.closed || !cc.canTakeNewRequestLocked() {
+			if waitingForConn != nil {
+				close(waitingForConn)
+			}
 			return errClientConnUnusable
 		}
 		if int64(len(cc.streams))+1 <= int64(cc.maxConcurrentStreams) {