[OpenWrt-Devel,1/3] examples: add .notify_write callback.
diff mbox

Message ID 1415702041-44573-1-git-send-email-yszhou4tech@gmail.com
State Accepted
Headers show

Commit Message

Yousong Zhou Nov. 11, 2014, 10:33 a.m. UTC
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 ustream-example-client.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Yousong Zhou Dec. 8, 2014, 2:56 a.m. UTC | #1
Hmm, sorry for being a little ambiguous.  The 3 patches in this series
is for ustream-ssl.  The other 5 patches in another series is for
libubox.

On 11 November 2014 at 18:33, Yousong Zhou <yszhou4tech@gmail.com> wrote:
>
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> ---
>  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);
> --
> 1.7.10.4
>

Patch
diff mbox

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);