Merge pull request #3535 from nspcc-dev/fix/possible-WS-deadlock-on-connection-loss

This commit is contained in:
Roman Khimov 2024-07-29 17:56:39 +03:00 committed by GitHub
commit c2a1c4af53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -601,7 +601,13 @@ readloop:
connCloseErr = fmt.Errorf("unknown response channel for response %d", id) connCloseErr = fmt.Errorf("unknown response channel for response %d", id)
break readloop // Unknown response (unexpected response ID). break readloop // Unknown response (unexpected response ID).
} }
ch <- &rr.Response select {
case <-c.writerDone:
break readloop
case <-c.shutdown:
break readloop
case ch <- &rr.Response:
}
} else { } else {
// Malformed response, neither valid request, nor valid response. // Malformed response, neither valid request, nor valid response.
connCloseErr = fmt.Errorf("malformed response") connCloseErr = fmt.Errorf("malformed response")