Browse Source

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>
Felix Fietkau 1 month ago
parent
commit
352fb3eeb4
1 changed files with 6 additions and 2 deletions
  1. 6 2
      uclient-http.c

+ 6 - 2
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;