From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSq4d-0002Xa-Uy for qemu-devel@nongnu.org; Mon, 29 Oct 2012 10:12:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSq4Y-0007Il-4R for qemu-devel@nongnu.org; Mon, 29 Oct 2012 10:12:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSq4X-0007Ib-TT for qemu-devel@nongnu.org; Mon, 29 Oct 2012 10:12:10 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9TEC9d6027882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 29 Oct 2012 10:12:09 -0400 From: Juan Quintela Date: Mon, 29 Oct 2012 15:11:35 +0100 Message-Id: <1351519903-26607-11-git-send-email-quintela@redhat.com> In-Reply-To: <1351519903-26607-1-git-send-email-quintela@redhat.com> References: <1351519903-26607-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 10/18] buffered_file: Unfold the trick to restart generating migration data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: owasserm@redhat.com, mtosatti@redhat.com, avi@redhat.com, pbonzini@redhat.com This was needed before due to the way that the callbacks worked. Signed-off-by: Juan Quintela --- buffered_file.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/buffered_file.c b/buffered_file.c index 283854f..018cab7 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -113,14 +113,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; } @@ -216,8 +208,15 @@ static void *buffered_file_thread(void *opaque) /* usleep expects microseconds */ g_usleep((expire_time - current_time)*1000); } - buffered_put_buffer(s, NULL, 0, 0); + buffered_flush(s); + + 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; -- 1.7.11.7