From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsUWZ-0006DX-BW for qemu-devel@nongnu.org; Mon, 16 Dec 2013 04:31:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsUWT-00029q-7n for qemu-devel@nongnu.org; Mon, 16 Dec 2013 04:31:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsUWS-00029O-O5 for qemu-devel@nongnu.org; Mon, 16 Dec 2013 04:31:33 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBG9VWxh031308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 Dec 2013 04:31:32 -0500 From: Gerd Hoffmann Date: Mon, 16 Dec 2013 10:31:03 +0100 Message-Id: <1387186277-9573-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1387186277-9573-1-git-send-email-kraxel@redhat.com> References: <1387186277-9573-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 02/16] 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann From: Marc-Andr=C3=A9 Lureau Fixes the following error: ** (process:780): CRITICAL **: do_socket_send: assertion `socket_to_send->len !=3D 0' failed Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Gerd Hoffmann --- libcacard/vscclient.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index f1d46d3..24f7088 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -58,7 +58,7 @@ static QemuMutex socket_to_send_lock; static guint socket_tag; =20 static void -update_socket_watch(gboolean out); +update_socket_watch(void); =20 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); =20 if (socket_to_send->len =3D=3D 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(); =20 return FALSE; } @@ -440,8 +440,10 @@ do_socket(GIOChannel *source, } =20 static void -update_socket_watch(gboolean out) +update_socket_watch(void) { + gboolean out =3D socket_to_send->len > 0; + if (socket_tag !=3D 0) { g_source_remove(socket_tag); } --=20 1.8.3.1