Comments
Patch
@@ -109,14 +109,18 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
return error;
}
- DPRINTF("unfreezing output\n");
- s->freeze_output = 0;
-
if (size > 0) {
DPRINTF("buffering %d bytes\n", size - offset);
buffered_append(s, buf, size);
}
+ if (pos == 0 && size == 0) {
+ DPRINTF("unfreezing output\n");
+ s->freeze_output = 0;
+ } else if (s->freeze_output) {
+ return size;
+ }
+
error = buffered_flush(s);
if (error < 0) {
DPRINTF("buffered flush error. bailing: %s\n", strerror(-error));
Only unfreeze if the call comes from migrate_fd_put_notify. If the output if frozen we can still add to the buffer (which will not grow in an unbounded manner anyway, both with and without the previous patch), but we will not try to flush until the socket becomes writable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- buffered_file.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)