update ping test client and stop exposing payload to extensions
Ping and Pong payload in control messages need to be
above the fray of extension payload munging
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/client-parser.c b/lib/client-parser.c
index 72e91b2..ee87d71 100644
--- a/lib/client-parser.c
+++ b/lib/client-parser.c
@@ -34,7 +34,7 @@
struct lws_tokens eff_buf;
int m;
- lwsl_parser(" CRX: %02X %d\n", c, wsi->lws_rx_parse_state);
+// lwsl_parser(" CRX: %02X %d\n", c, wsi->lws_rx_parse_state);
switch (wsi->lws_rx_parse_state) {
case LWS_RXPS_NEW:
@@ -401,6 +401,7 @@
return -1;
case LWS_WS_OPCODE_07__PING:
+ lwsl_info("client received ping, doing pong\n");
/* parrot the ping packet payload back as a pong*/
n = libwebsocket_write(wsi, (unsigned char *)
&wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING],
@@ -409,6 +410,9 @@
break;
case LWS_WS_OPCODE_07__PONG:
+ lwsl_info("client receied pong\n");
+ lwsl_hexdump(&wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING],
+ wsi->rx_user_buffer_head);
/* keep the statistics... */
wsi->pings_vs_pongs--;
@@ -486,7 +490,9 @@
if (eff_buf.token_len > 0) {
eff_buf.token[eff_buf.token_len] = '\0';
- if (wsi->protocol->callback)
+ if (wsi->protocol->callback) {
+ if (callback_action == LWS_CALLBACK_CLIENT_RECEIVE_PONG)
+ lwsl_info("Client doing pong callback\n");
wsi->protocol->callback(
wsi->protocol->owning_server,
wsi,
@@ -494,6 +500,7 @@
wsi->user_space,
eff_buf.token,
eff_buf.token_len);
+ }
}
already_done:
wsi->rx_user_buffer_head = 0;