Received: from eggs.gnu.org ([2001:4830:134:3::10]:50477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViNtz-0003Tv-19 for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViNtq-0006NA-94 for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:26:02 -0500 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:46063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViNtq-0006Ms-27 for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:25:54 -0500 Received: by mail-wg0-f48.google.com with SMTP id n12so5983275wgh.3 for ; Mon, 18 Nov 2013 04:25:53 -0800 (PST) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 18 Nov 2013 13:25:11 +0100 Message-Id: <1384777531-14635-2-git-send-email-marcandre.lureau@gmail.com> In-Reply-To: <1384777531-14635-1-git-send-email-marcandre.lureau@gmail.com> References: <1384777531-14635-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 01/21] vscclient: do not add a socket watch if there is not data to send List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jcody@redhat.com, kraxel@redhat.com, spice-devel@freedesktop.org From: Marc-André Lureau Fixes the following error: ** (process:780): CRITICAL **: do_socket_send: assertion `socket_to_send->len != 0' failed Signed-off-by: Marc-André Lureau --- libcacard/vscclient.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index a3cb776..c413a4f 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -58,7 +58,7 @@ static QemuMutex socket_to_send_lock; static guint socket_tag; static void -update_socket_watch(gboolean out); +update_socket_watch(void); static gboolean do_socket_send(GIOChannel *source, @@ -80,7 +80,7 @@ do_socket_send(GIOChannel *source, g_byte_array_remove_range(socket_to_send, 0, bw); if (socket_to_send->len == 0) { - update_socket_watch(FALSE); + update_socket_watch(); return FALSE; } return TRUE; @@ -89,7 +89,7 @@ do_socket_send(GIOChannel *source, static gboolean socket_prepare_sending(gpointer user_data) { - update_socket_watch(TRUE); + update_socket_watch(); return FALSE; } @@ -440,8 +440,10 @@ do_socket(GIOChannel *source, } static void -update_socket_watch(gboolean out) +update_socket_watch(void) { + gboolean out = socket_to_send->len > 0; + if (socket_tag != 0) { g_source_remove(socket_tag); } -- 1.8.3.1