瀏覽代碼

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 月之前
父節點
當前提交
352fb3eeb4
共有 1 個文件被更改,包括 6 次插入2 次删除
  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;