diff --git a/lib/faraday.ml b/lib/faraday.ml index 74fd79a..f25db14 100644 --- a/lib/faraday.ml +++ b/lib/faraday.ml @@ -203,6 +203,7 @@ let flush_buffer t = end let flush t f = + t.yield <- false; flush_buffer t; if Buffers.is_empty t.scheduled then f () else Flushes.enqueue (t.bytes_received, f) t.flushed diff --git a/lib/faraday.mli b/lib/faraday.mli index 4c5dcbc..11412bd 100644 --- a/lib/faraday.mli +++ b/lib/faraday.mli @@ -215,7 +215,9 @@ val yield : t -> unit val flush : t -> (unit -> unit) -> unit (** [flush t f] registers [f] to be called when all prior writes have been successfully completed. If [t] has no pending writes, then [f] will be - called immediately. *) + called immediately. If {!yield} was recently called on [t], then the effect + of the [yield] will be ignored so that client code has an opportunity to + write pending output, regardless of how it handles [`Yield] operations. *) val close : t -> unit (** [close t] closes [t]. All subsequent write calls will raise, and any