Ver Fonte

simple write for single buffer

Darien Raymond há 7 anos atrás
pai
commit
950612544b
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      common/buf/writer.go

+ 4 - 0
common/buf/writer.go

@@ -21,6 +21,10 @@ func (w *BufferToBytesWriter) WriteMultiBuffer(mb MultiBuffer) error {
 		return nil
 	}
 
+	if len(mb) == 1 {
+		return WriteAllBytes(w.Writer, mb[0].Bytes())
+	}
+
 	bs := mb.ToNetBuffers()
 
 	for size > 0 {