Parcourir la source

simple write for single buffer

Darien Raymond il y a 7 ans
Parent
commit
950612544b
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  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 {