[OpenWrt-Devel] [PATCH][uclient] http: implement data_sent write callback

Luka Perkov luka at openwrt.org
Mon Jul 7 04:11:41 EDT 2014


Signed-off-by: Luka Perkov <luka at openwrt.org>
---
 uclient-http.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/uclient-http.c b/uclient-http.c
index 9652fb8..b9de3a7 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -653,6 +653,12 @@ static void __uclient_notify_read(struct uclient_http *uh)
 		uc->cb->data_read(uc);
 }
 
+static void __uclient_notify_write(struct uclient_http *uh)
+{
+	struct uclient *uc = &uh->uc;
+	uc->cb->data_sent(uc);
+}
+
 static void uclient_notify_read(struct ustream *us, int bytes)
 {
 	struct uclient_http *uh = container_of(us, struct uclient_http, ufd.stream);
@@ -660,6 +666,13 @@ static void uclient_notify_read(struct ustream *us, int bytes)
 	__uclient_notify_read(uh);
 }
 
+static void uclient_notify_write(struct ustream *us, int bytes)
+{
+	struct uclient_http *uh = container_of(us, struct uclient_http, ufd.stream);
+
+	__uclient_notify_write(uh);
+}
+
 static void uclient_notify_state(struct ustream *us)
 {
 	struct uclient_http *uh = container_of(us, struct uclient_http, ufd.stream);
@@ -678,6 +691,7 @@ static int uclient_setup_http(struct uclient_http *uh)
 	us->string_data = true;
 	us->notify_state = uclient_notify_state;
 	us->notify_read = uclient_notify_read;
+	us->notify_write = uclient_notify_write;
 
 	ret = uclient_do_connect(uh, "80");
 	if (ret)
@@ -693,6 +707,13 @@ static void uclient_ssl_notify_read(struct ustream *us, int bytes)
 	__uclient_notify_read(uh);
 }
 
+static void uclient_ssl_notify_write(struct ustream *us, int bytes)
+{
+	struct uclient_http *uh = container_of(us, struct uclient_http, ussl.stream);
+
+	__uclient_notify_write(uh);
+}
+
 static void uclient_ssl_notify_state(struct ustream *us)
 {
 	struct uclient_http *uh = container_of(us, struct uclient_http, ussl.stream);
@@ -746,6 +767,7 @@ static int uclient_setup_https(struct uclient_http *uh)
 	us->string_data = true;
 	us->notify_state = uclient_ssl_notify_state;
 	us->notify_read = uclient_ssl_notify_read;
+	us->notify_write = uclient_ssl_notify_write;
 	uh->ussl.notify_error = uclient_ssl_notify_error;
 	uh->ussl.notify_verify_error = uclient_ssl_notify_verify_error;
 	uh->ussl.notify_connected = uclient_ssl_notify_connected;
-- 
2.0.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list