truncated send issue independent of LWS_NO_EXTENSIONS 2
authorAndy Green <andy.green@linaro.org>
Tue, 1 Apr 2014 06:20:44 +0000 (14:20 +0800)
committerAndy Green <andy.green@linaro.org>
Tue, 1 Apr 2014 06:20:44 +0000 (14:20 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/output.c

index f711f2a..afc93ae 100644 (file)
@@ -105,6 +105,10 @@ int lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len)
 
 #ifndef LWS_NO_EXTENSIONS
        int m;
+#endif
+       
+       if (!len)
+               return 0;
 
        if (wsi->truncated_send_len && (buf < wsi->truncated_send_malloc ||
                        buf > (wsi->truncated_send_malloc +
@@ -114,6 +118,7 @@ int lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len)
                assert(0);
        }
 
+#ifndef LWS_NO_EXTENSIONS
        /*
         * one of the extensions is carrying our data itself?  Like mux?
         */
@@ -639,7 +644,7 @@ send_raw:
         */
 
        n = lws_issue_raw_ext_access(wsi, buf - pre, len + pre + post);
-       if (n < 0)
+       if (n <= 0)
                return n;
 
        if (n == len + pre + post) {