From patchwork Thu Jun 4 13:41:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 480747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AB9541401DA for ; Thu, 4 Jun 2015 23:57:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=APKDoE27; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C9A4928C0E4; Thu, 4 Jun 2015 15:52:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id F1AB428C0BC for ; Thu, 4 Jun 2015 15:52:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-pa0-f53.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 4 Jun 2015 15:52:13 +0200 (CEST) Received: by pabqy3 with SMTP id qy3so30027973pab.3 for ; Thu, 04 Jun 2015 06:53: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:in-reply-to:references; bh=7jJEIuWsVWeC1/9Z3OTlrcE/cY+N5TgNq6enshqTkr0=; b=APKDoE271j0k6/7PK2PqwVi1z04GyBhlvJMxeoQWaTpe1Lag5Ioy6n7QsbB/J1xRgQ JkzOYF44yvijuSdxSByHEmMcxVZhnvkaMzT5ShQq3vX37n2OPRyF5QTVXd+lgoonzw3h PlHmz4WrgBqCD3U+HDCQriJCEpn1gUjby781CETs4XfA8nLuPVnSrtilq6usGIdq5CxO TF6Y2oz3EalM86qJ/7h92IPXtqkewWkviPC8J+FzED7OQ5f/vR25//eO3z/rc50JfW6p ZcYvHrcO15IIoQyzbt3cuIqCsRZ82S1w7XZ1mG5EZJqQlek8T53Mm19bq8o6Th91k1ry 04Wg== X-Received: by 10.70.136.67 with SMTP id py3mr6219323pdb.112.1433426016128; Thu, 04 Jun 2015 06:53:36 -0700 (PDT) Received: from debian.corp.sankuai.com ([103.29.140.58]) by mx.google.com with ESMTPSA id qt4sm3885676pbc.86.2015.06.04.06.53.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 06:53:35 -0700 (PDT) From: Yousong Zhou To: nbd@openwrt.org Date: Thu, 4 Jun 2015 21:41:42 +0800 Message-Id: <1433425302-26448-6-git-send-email-yszhou4tech@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1433425302-26448-1-git-send-email-yszhou4tech@gmail.com> References: <1433425302-26448-1-git-send-email-yszhou4tech@gmail.com> Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 5/5] ustream-fd: stop trying to read when s->read_blocked is set. X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" User's s->notify_read is called in ustream_fill_read(). If s->read_blocked is set there, then stop reading more. Signed-off-by: Yousong Zhou --- ustream-fd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ustream-fd.c b/ustream-fd.c index daef499..5ffca53 100644 --- a/ustream-fd.c +++ b/ustream-fd.c @@ -50,6 +50,9 @@ static void ustream_fd_read_pending(struct ustream_fd *sf, bool *more) char *buf; do { + if (s->read_blocked) + break; + buf = ustream_reserve(s, 1, &buflen); if (!buf) break;