Procházet zdrojové kódy

flush when not buffered

Darien Raymond před 8 roky
rodič
revize
743d35c059
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      common/buf/writer.go

+ 2 - 1
common/buf/writer.go

@@ -67,13 +67,14 @@ func (w *BufferedWriter) Write(b []byte) (int, error) {
 		if err != nil {
 			return totalBytes, err
 		}
-		if w.buffer.IsFull() {
+		if !w.buffered || w.buffer.IsFull() {
 			if err := w.Flush(); err != nil {
 				return totalBytes, err
 			}
 		}
 		b = b[nBytes:]
 	}
+
 	return totalBytes, nil
 }