mirror of
https://github.com/golang/go
synced 2024-11-19 11:44:45 -07:00
net/http: fix timer leak in Transport when using ResponseHeaderTimeout
Fixes #9104 Change-Id: Ide5ac70215d73278e6910f5b9c7687ad7734c0be Reviewed-on: https://go-review.googlesource.com/1530 Reviewed-by: David Symonds <dsymonds@golang.org>
This commit is contained in:
parent
d160d1bc87
commit
0e4ee0c9bf
@ -1087,7 +1087,9 @@ WaitResponse:
|
|||||||
break WaitResponse
|
break WaitResponse
|
||||||
}
|
}
|
||||||
if d := pc.t.ResponseHeaderTimeout; d > 0 {
|
if d := pc.t.ResponseHeaderTimeout; d > 0 {
|
||||||
respHeaderTimer = time.After(d)
|
timer := time.NewTimer(d)
|
||||||
|
defer timer.Stop() // prevent leaks
|
||||||
|
respHeaderTimer = timer.C
|
||||||
}
|
}
|
||||||
case <-pconnDeadCh:
|
case <-pconnDeadCh:
|
||||||
// The persist connection is dead. This shouldn't
|
// The persist connection is dead. This shouldn't
|
||||||
|
Loading…
Reference in New Issue
Block a user