mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 20:07:38 +03:00
Fix write nil in buffered vectorised writer
This commit is contained in:
parent
2adcd8e205
commit
18cd006d26
1 changed files with 5 additions and 0 deletions
|
@ -65,6 +65,11 @@ type BufferedVectorisedWriter struct {
|
|||
func (w *BufferedVectorisedWriter) WriteVectorised(buffers []*buf.Buffer) error {
|
||||
defer buf.ReleaseMulti(buffers)
|
||||
bufferLen := buf.LenMulti(buffers)
|
||||
if bufferLen == 0 {
|
||||
return common.Error(w.upstream.Write(nil))
|
||||
} else if len(buffers) == 1 {
|
||||
return common.Error(w.upstream.Write(buffers[0].Bytes()))
|
||||
}
|
||||
var bufferBytes []byte
|
||||
if bufferLen > 65535 {
|
||||
bufferBytes = make([]byte, bufferLen)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue