summaryrefslogtreecommitdiffstats
path: root/buffered_file.c
diff options
context:
space:
mode:
authorJuan Quintela2012-07-24 13:22:18 +0200
committerJuan Quintela2012-12-20 23:09:25 +0100
commit78d1d231f889f7eae3835ddaec4373011792e46f (patch)
tree510ba0cb383437505716ab43443dd743f1533dc9 /buffered_file.c
parentmigration: just lock migrate_fd_put_ready (diff)
downloadqemu-78d1d231f889f7eae3835ddaec4373011792e46f.tar.gz
qemu-78d1d231f889f7eae3835ddaec4373011792e46f.tar.xz
qemu-78d1d231f889f7eae3835ddaec4373011792e46f.zip
buffered_file: Unfold the trick to restart generating migration data
This was needed before due to the way that the callbacks worked. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'buffered_file.c')
-rw-r--r--buffered_file.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/buffered_file.c b/buffered_file.c
index 7743fbdbca..d61d805de7 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -112,14 +112,6 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
return error;
}
- if (pos == 0 && size == 0) {
- DPRINTF("file is ready\n");
- if (s->bytes_xfer < s->xfer_limit) {
- DPRINTF("notifying client\n");
- migrate_fd_put_ready(s->migration_state);
- }
- }
-
return size;
}
@@ -222,8 +214,17 @@ static void *buffered_file_thread(void *opaque)
/* usleep expects microseconds */
g_usleep((expire_time - current_time)*1000);
}
- buffered_put_buffer(s, NULL, 0, 0);
+ if (buffered_flush(s) < 0) {
+ break;
+ }
+
+ DPRINTF("file is ready\n");
+ if (s->bytes_xfer < s->xfer_limit) {
+ DPRINTF("notifying client\n");
+ migrate_fd_put_ready(s->migration_state);
+ }
}
+
g_free(s->buffer);
g_free(s);
return NULL;