Explorar el Código

flush when not buffered

Darien Raymond hace 8 años
padre
commit
743d35c059
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  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
 }