summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2014-11-11 18:33:59 +0800
committerFelix Fietkau <nbd@openwrt.org>2014-12-11 17:20:54 +0100
commita4bdbd817a9006bc08cd1d2c8d88c63cb963067b (patch)
tree7ed1fab64e8f6d3e4538570f598ea3f47fc7b2af
parentb1c19610b2f4637c7dfe1b620b6474bbb9b23fe4 (diff)
downloadustream-ssl-a4bdbd817a9006bc08cd1d2c8d88c63cb963067b.tar.gz
examples: add .notify_write callback.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r--ustream-example-client.c6
1 files changed, 6 insertions, 0 deletions
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);