1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

properly handle error case

This commit is contained in:
Darien Raymond 2018-04-05 12:19:57 +02:00
parent 61a1cce972
commit 2b675335bd
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -203,7 +203,11 @@ func (m *Client) handleStatusKeep(meta *FrameMetadata, reader *buf.BufferedReade
}
if s, found := m.sessionManager.Get(meta.SessionID); found {
return buf.Copy(s.NewReader(reader), s.output, buf.IgnoreWriterError())
if err := buf.Copy(s.NewReader(reader), s.output); err != nil {
drain(reader)
s.input.CloseError()
return s.Close()
}
}
return drain(reader)
}
@ -359,7 +363,11 @@ func (w *ServerWorker) handleStatusKeep(meta *FrameMetadata, reader *buf.Buffere
return nil
}
if s, found := w.sessionManager.Get(meta.SessionID); found {
return buf.Copy(s.NewReader(reader), s.output, buf.IgnoreWriterError())
if err := buf.Copy(s.NewReader(reader), s.output); err != nil {
drain(reader)
s.input.CloseError()
return s.Close()
}
}
return drain(reader)
}