From: Felix Fietkau Date: Wed, 27 Mar 2024 21:29:38 +0000 (+0100) Subject: http: call ustream_poll if not enough read data is available X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=352fb3eeb40846d576e942ed2674fde052b2d81c;hp=b6e5548a3ecc562db4c8d5356bdfd9a3fa5e59f8;p=project%2Fuclient.git http: call ustream_poll if not enough read data is available Avoids having to go through another uloop notification for the next read. Signed-off-by: Felix Fietkau --- diff --git a/uclient-http.c b/uclient-http.c index 83c268f..33f6513 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -1077,8 +1077,12 @@ uclient_http_read(struct uclient *cl, char *buf, unsigned int len) return 0; data = ustream_get_read_buf(uh->us, &read_len); - if (!data || !read_len) - return 0; + if (!data || !read_len) { + ustream_poll(uh->us); + data = ustream_get_read_buf(uh->us, &read_len); + if (!data || !read_len) + return 0; + } data_end = data + read_len; read_len = 0;