Yousong Zhou
9386d0717a
ustream: tweak ustream_prepare_buf() a bit.
...
No functional change.
- Reuse existing NULL check on buf.
- Add some comments for ease of reading the code.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14 15:15:43 +02:00
Yousong Zhou
60236c4853
ustream: add function ustream_read().
...
It can be used to fill caller-specified buffer 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));
}
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-21 20:00:39 +01:00
Felix Fietkau
c725f9f7a5
ustream: remove unnecessary initialization
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:21:13 +02:00
Felix Fietkau
734d28eb1a
ustream: properly clear fields to fix ustream reuse
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-19 18:20:03 +02:00
Felix Fietkau
c434230a76
ustream: return NULL in ustream_get_read_buf if there's a buffer, but no data
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 19:53:09 +02:00
Felix Fietkau
70e7c09bcb
ustream: only report a write error once via state_change callback
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-31 11:17:02 +02:00
Felix Fietkau
8686989fff
ustream: increment receive buffer count
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-03 16:32:49 +01:00
Felix Fietkau
29c066cfd6
ustream: avoid calling s->poll from a write path to avoid looping back through the notify_write cb
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-30 19:21:03 +01:00
Felix Fietkau
300a809a7a
ustream: fix polling for write buffer availability after buffering writes
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-30 17:26:40 +01:00
Felix Fietkau
84822fd6d5
ustream: suppress write attempts in ustream_printf and ustream_vprintf if a write error was flagged
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-30 15:46:18 +01:00
Felix Fietkau
a9b44ebe55
ustream: make notify_state optional as well
2012-10-30 00:00:57 +01:00
Felix Fietkau
df0968d19b
ustream: fix variable initialization
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-10-29 23:11:08 +01:00
Felix Fietkau
42cd90bf4b
ustream: make ustream_init_buf static
2012-10-22 20:02:38 +02:00
Felix Fietkau
768a69b3ce
add ustream, an api for stream buffer management
2012-10-21 23:00:06 +02:00