From patchwork Thu Aug 8 06:26:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 265660 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 94AAE2C00B8 for ; Thu, 8 Aug 2013 16:28:00 +1000 (EST) Received: from localhost ([::1]:52648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7JhW-0000gE-Ej for incoming@patchwork.ozlabs.org; Thu, 08 Aug 2013 02:27:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7Jgs-0000HK-Mc for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:27:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7Jgk-00019T-8y for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:27:18 -0400 Received: from mail-pd0-x231.google.com ([2607:f8b0:400e:c02::231]:53604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7Jgk-00019M-33 for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:27:10 -0400 Received: by mail-pd0-f177.google.com with SMTP id u10so2222726pdi.36 for ; Wed, 07 Aug 2013 23:27:09 -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:in-reply-to:references; bh=O2RH7XfY0+KirF1spBSybdhHoJn6R8clH79F8eE3Bvc=; b=PT4xNtCoIPA8iZrk5CnrPtM72OVywa/XMg1lc5WEQz+xqIlPmboWwxWn71+tuf5RHP WSzG1fTL5+ilMDfssH2F0sjn2p8wVQbfi/IxIrPCubnEkZnH8Rxoz2xSU0m4G3TgRVX3 VPSF05x8m/p3yRSaoM1N1mrnGzGayS9Eb5m/ThQ8smEsqKWV+qvp1nAzAxDTijgAEoZD Fycah926LeyN4naPrwju+Mo+wamvMdMBJy9BqWLPKEqKqkIz73o/e4v//8F2oyBnMU1l Pr7Cztxl0ORD2kteZF7e3VIyoKM/AHX/uuc5TUXU+YcWq+5H933Q6ZZUWAQfI5j/W9+G 3jRA== X-Received: by 10.68.212.106 with SMTP id nj10mr4419418pbc.74.1375943229250; Wed, 07 Aug 2013 23:27:09 -0700 (PDT) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPSA id ht5sm12235322pbb.29.2013.08.07.23.27.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 07 Aug 2013 23:27:08 -0700 (PDT) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Thu, 8 Aug 2013 14:26:10 +0800 Message-Id: <1375943171-1063-5-git-send-email-pingfank@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1375943171-1063-1-git-send-email-pingfank@linux.vnet.ibm.com> References: <1375943171-1063-1-git-send-email-pingfank@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::231 Cc: Paolo Bonzini , mdroth , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v1 4/5] slirp: decouple timeout for gpoll 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 In order to decouple with main loop, we fill timeout for gpoll through slirp's GSource prepare. (Later, after curtime is decoupled, slirp system will be self-contained, and isolated from main-loop) Signed-off-by: Liu Ping Fan --- slirp/slirp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index 37244be..ecc4d88 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -260,9 +260,6 @@ void slirp_cleanup(Slirp *slirp) void slirp_update_timeout(uint32_t *timeout) { - if (!QTAILQ_EMPTY(&slirp_instances)) { - *timeout = MIN(1000, *timeout); - } curtime = qemu_get_clock_ms(rt_clock); } @@ -273,6 +270,7 @@ gboolean slirp_prepare(GSource *source, gint *time) struct socket *so, *so_next; int events = 0; + *time = MIN(1000, *time); /* * *_slowtimo needs calling if there are IP fragments * in the fragment queue, or there are TCP connections active