mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-13 15:48:39 +00:00
Add recover() to H2 server's flushWriter.Write()
Fixes https://github.com/XTLS/Xray-core/issues/1748
This commit is contained in:
parent
4a0b45d1ff
commit
836e84b851
2 changed files with 10 additions and 5 deletions
|
@ -204,7 +204,7 @@ type WaitReadCloser struct {
|
|||
func (w *WaitReadCloser) Set(rc io.ReadCloser) {
|
||||
w.ReadCloser = rc
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
if recover() != nil {
|
||||
rc.Close()
|
||||
}
|
||||
}()
|
||||
|
@ -225,10 +225,8 @@ func (w *WaitReadCloser) Close() error {
|
|||
return w.ReadCloser.Close()
|
||||
}
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
if w.ReadCloser != nil {
|
||||
w.ReadCloser.Close()
|
||||
}
|
||||
if recover() != nil && w.ReadCloser != nil {
|
||||
w.ReadCloser.Close()
|
||||
}
|
||||
}()
|
||||
close(w.Wait)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue