On 22 December 2014 at 22:46, Felix Fietkau <n...@openwrt.org> wrote: > On 2014-12-16 22:15, Yousong Zhou wrote: >> It can be used to fill caller specified buffer area with data already in >> ustream read buffer. Useful in the following use pattern. >> >> int available = ustream_pending_data(s, false); >> if (available >= sizeof(struct msghdr)) { >> struct msghdr h; >> ustream_read(s, &h, sizeof(h)); >> } >>
<snip> >> + > I'd expect ustream_read() to consume the data it has read. > It should also probably just use ustream_get_read_buf() and > ustream_consume() instead of open-coding its functionality. I tend to peek inside the msghdr to get the total length then consume them as a whole if there is enough available in the read buffer. But I am fine with either way. Regards. yousong _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel