mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
Merge pull request #2318 from rwcarlsen/fix-closenotify-panic2
fix another panic where CloseNotify was called from wrong goroutine
This commit is contained in:
@ -114,9 +114,10 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
if cn, ok := w.(http.CloseNotifier); ok {
|
if cn, ok := w.(http.CloseNotifier); ok {
|
||||||
|
clientGone := cn.CloseNotify()
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-cn.CloseNotify():
|
case <-clientGone:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
}
|
}
|
||||||
cancel()
|
cancel()
|
||||||
|
Reference in New Issue
Block a user