From patchwork Tue Nov 11 10:33:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 418546 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.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 505751400A0 for ; Mon, 8 Dec 2014 13:33:40 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 584CB281571; Mon, 8 Dec 2014 03:31:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DATE_IN_PAST_96_XX, FREEMAIL_FROM,T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id B01F62800EA for ; Mon, 8 Dec 2014 03:31:47 +0100 (CET) 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-pd0-f174.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 8 Dec 2014 03:31:44 +0100 (CET) Received: by mail-pd0-f174.google.com with SMTP id fp1so3916138pdb.33 for ; Sun, 07 Dec 2014 18:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=4YBFsWUvseutA4qq132zHeJz6UESduiwPTOGCnwdi78=; b=xCEkHFZw74MMusXB+s+IlTJ+1VInCl9cLvaOCCj3InHchmkwPcicqEh73LX3ku6dxt SBuEJdIGRe874sEU2N76INrcvZW9BSGB8C4mZG2iliCdM9Yuvv3kZi8X6vVGoMlilHMa M7sNehp0zat886CWdLF0tI5FFYvvJWQAnFl28EZxq4USYjN2xE7tx33Co7ojZPQIAe8f h2DpL9gvFjdFOfa3/BgnOBUj+LoTIYLBEezwYI3npgR6wvaxPkD4E3TlqNYnN2Uz0ZyB 9ZO27qRyGpYiN5xGF2pkDxRaFnqlLwe6VkZuDLp/AbUoc5jdvS6i6559xSa5ngwbdaAh THBA== X-Received: by 10.67.22.40 with SMTP id hp8mr49348933pad.38.1418006005187; Sun, 07 Dec 2014 18:33:25 -0800 (PST) Received: from debian.lan ([103.29.140.56]) by mx.google.com with ESMTPSA id fr1sm20456632pbb.32.2014.12.07.18.33.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Dec 2014 18:33:24 -0800 (PST) From: Yousong Zhou To: openwrt-devel@lists.openwrt.org Date: Tue, 11 Nov 2014 18:33:59 +0800 Message-Id: <1415702041-44573-1-git-send-email-yszhou4tech@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [OpenWrt-Devel] [PATCH 1/3] examples: add .notify_write callback. 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" Signed-off-by: Yousong Zhou --- ustream-example-client.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ustream-example-client.c b/ustream-example-client.c index fc49146..6527362 100644 --- a/ustream-example-client.c +++ b/ustream-example-client.c @@ -46,6 +46,11 @@ static void client_ssl_notify_read(struct ustream *s, int bytes) ustream_consume(s, len); } +static void client_ssl_notify_write(struct ustream *s, int bytes) +{ + fprintf(stderr, "Wrote %d bytes, pending %d\n", bytes, s->w.data_bytes); +} + static void client_notify_connected(struct ustream_ssl *ssl) { fprintf(stderr, "SSL connection established (CN verified: %d)\n", ssl->valid_cn); @@ -81,6 +86,7 @@ static void example_connect_ssl(int fd) ssl.notify_verify_error = client_notify_verify_error; ssl.notify_connected = client_notify_connected; ssl.stream.notify_read = client_ssl_notify_read; + ssl.stream.notify_write = client_ssl_notify_write; ssl.stream.notify_state = client_notify_state; ustream_fd_init(&stream, fd);