fix compile errors on linux
[project/ustream-ssl.git] / ustream-example.c
index 01e3aab..ea22067 100644 (file)
@@ -5,6 +5,7 @@
 #include <getopt.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <libubox/ustream.h>
 #include <libubox/uloop.h>
@@ -75,7 +76,7 @@ static void client_read_cb(struct ustream *s, int bytes)
                cl->ctr += newline + 1 - str;
        } while(1);
 
-       if (s->w.data_bytes > 256 && ustream_read_blocked(s)) {
+       if (s->w.data_bytes > 256 && !ustream_read_blocked(s)) {
                fprintf(stderr, "Block read, bytes: %d\n", s->w.data_bytes);
                ustream_set_read_blocked(s, true);
        }