summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-03-27 21:29:38 +0000
committerFelix Fietkau2024-03-29 14:09:36 +0000
commit352fb3eeb40846d576e942ed2674fde052b2d81c (patch)
tree3480a5448a92d0457cb53d40de6affcb749b4b73
parentb6e5548a3ecc562db4c8d5356bdfd9a3fa5e59f8 (diff)
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 <nbd@nbd.name>
-rw-r--r--uclient-http.c8
1 files changed, 6 insertions, 2 deletions
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;