Sfoglia il codice sorgente

simple write for single buffer

Darien Raymond 7 anni fa
parent
commit
950612544b
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  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 {