examples: add .notify_write callback.
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 11 Nov 2014 10:33:59 +0000 (18:33 +0800)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 11 Dec 2014 16:20:54 +0000 (17:20 +0100)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
ustream-example-client.c

index fc49146a1f72fd414ddf07ec4843ddf5c3380cef..65273622a4f4b85b13ebd317cfcac86460b22057 100644 (file)
@@ -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);