From patchwork Thu Jun 6 13:44:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 249426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 411C52C0091 for ; Thu, 6 Jun 2013 23:45:27 +1000 (EST) Received: from localhost ([::1]:50845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkaV2-0003ql-N7 for incoming@patchwork.ozlabs.org; Thu, 06 Jun 2013 09:45:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkaUZ-0003iO-0u for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:44:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkaUX-0005XL-US for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:44:38 -0400 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]:60191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkaUX-0005XF-OF for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:44:37 -0400 Received: by mail-we0-f182.google.com with SMTP id p60so365970wes.41 for ; Thu, 06 Jun 2013 06:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=3b/hSz1LFFFNn7oBoaU5hCbIpEz3Jn/4D8VKv/yvacE=; b=kfSPEL3HgSDzDhwkbwSpcA0Y1WcYQM7xtvUI3Bo4b0Eipfb8kD++rTR1fwnoU/Tdal i0kR3FpKSzER/P5T+6rZfBFz6FLSPkbaAPZOx6KPl0JtN8U00Q2kStEiRdRKNcPj2rGK 8yg8uNkNOERWncqG5fZY33l8cjSl772t+MzfnNp55rsaecC/2HJAOIqXrGjlL/3UcNFt Qgqnz+25a92KyhEecxXBhXoaYY7GkkPQMSub7i4dUczbX3K3qfx6nl49hEUrRzq2jnp6 QnZLlIE2ojxZCRlibRZLTwIolln1CdTMuh3dp0u4rnymB6vVFqG2bi9hhkMLTartG4W9 yZ6A== X-Received: by 10.180.160.170 with SMTP id xl10mr9881481wib.56.1370526276631; Thu, 06 Jun 2013 06:44:36 -0700 (PDT) Received: from localhost (158.red-80-26-177.adsl.dynamic.ccgg.telefonica.net. [80.26.177.158]) by mx.google.com with ESMTPSA id cw8sm15906507wib.7.2013.06.06.06.44.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 06 Jun 2013 06:44:35 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2013 15:44:28 +0200 Message-Id: <1370526268-5612-1-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.8.3.rc1.49.g8d97506 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::236 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH] vscclient: do not add a socket watch if there is not data to send X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 ac23647..d976edc 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); }