ustream: only report a write error once via state_change callback
authorFelix Fietkau <nbd@openwrt.org>
Fri, 31 May 2013 09:17:02 +0000 (11:17 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 31 May 2013 09:17:02 +0000 (11:17 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ustream.c

index 719af992030e76d11529cca1c813f3ab0738e74d..88f13326a471d58b17b67495fc833da30066fd7d 100644 (file)
--- a/ustream.c
+++ b/ustream.c
@@ -330,8 +330,9 @@ char *ustream_get_read_buf(struct ustream *s, int *buflen)
 
 static void ustream_write_error(struct ustream *s)
 {
+       if (!s->write_error)
+               ustream_state_change(s);
        s->write_error = true;
-       ustream_state_change(s);
 }
 
 bool ustream_write_pending(struct ustream *s)