From 03cf1dde39c680dc24b207add7aaf7d9a0bcc4d3 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 1 Apr 2014 14:20:44 +0800 Subject: [PATCH] truncated send issue independent of LWS_NO_EXTENSIONS 2 Signed-off-by: Andy Green --- lib/output.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/output.c b/lib/output.c index f711f2ab9..afc93ae61 100644 --- a/lib/output.c +++ b/lib/output.c @@ -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) {