1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

fix zero length ping pong

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2014-02-15 16:00:37 +08:00
parent f975f73640
commit 8ea1955c3e
3 changed files with 12 additions and 5 deletions

View file

@ -382,7 +382,7 @@ spill:
}
}
#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';

View file

@ -569,8 +569,8 @@ do_more_inside_frame:
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) {

View file

@ -670,8 +670,13 @@ handle_first:
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 @@ handle_first:
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;