Explorar o código

simple write for single buffer

Darien Raymond %!s(int64=7) %!d(string=hai) anos
pai
achega
950612544b
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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 {