fix zero length ping pong
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/client-parser.c b/lib/client-parser.c
index e548b4f..b6b592b 100644
--- a/lib/client-parser.c
+++ b/lib/client-parser.c
@@ -382,7 +382,7 @@
}
}
#endif
- if (eff_buf.token_len <= 0)
+ if (eff_buf.token_len <= 0 && callback_action != LWS_CALLBACK_CLIENT_RECEIVE_PONG)
goto already_done;
eff_buf.token[eff_buf.token_len] = '\0';
diff --git a/lib/output.c b/lib/output.c
index 990cc6c..173cda4 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -569,8 +569,8 @@
send_raw:
#if 0
- lwsl_debug("send %ld: ", len + post);
- lwsl_hexdump(&buf[-pre], len + post);
+ lwsl_debug("send %ld: ", len + pre + post);
+ lwsl_hexdump(&buf[-pre], len + pre + post);
#endif
switch (protocol) {
diff --git a/lib/parsers.c b/lib/parsers.c
index 0502f70..dcf1cdc 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -670,8 +670,13 @@
wsi->lws_rx_parse_state =
LWS_RXPS_07_COLLECT_FRAME_KEY_1;
else
- wsi->lws_rx_parse_state =
+ if (wsi->u.ws.rx_packet_length)
+ wsi->lws_rx_parse_state =
LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
+ else {
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
+ goto spill;
+ }
break;
}
break;
@@ -779,8 +784,10 @@
wsi->lws_rx_parse_state =
LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
wsi->u.ws.frame_mask_index = 0;
- if (wsi->u.ws.rx_packet_length == 0)
+ if (wsi->u.ws.rx_packet_length == 0) {
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
+ }
break;