Skip to content
Snippets Groups Projects
Commit 82eccf76 authored by Andy Green's avatar Andy Green
Browse files

close send close ack control packet type


Noticed by Andrey Pokrovskiy

Close processing reused ping processing to save and send the payload,
and sets a flag to know it's close, but forgot to change the control
packet accordingly.

Signed-off-by: default avatarAndy Green <andy.green@linaro.org>
parent f1b12544
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context, ...@@ -55,6 +55,7 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
#endif #endif
int ret; int ret;
int m; int m;
int write_type = LWS_WRITE_PONG;
/* pending truncated sends have uber priority */ /* pending truncated sends have uber priority */
...@@ -94,11 +95,15 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context, ...@@ -94,11 +95,15 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
if (wsi->state == WSI_STATE_ESTABLISHED && if (wsi->state == WSI_STATE_ESTABLISHED &&
wsi->u.ws.ping_pending_flag) { wsi->u.ws.ping_pending_flag) {
if (wsi->u.ws.payload_is_close)
write_type = LWS_WRITE_CLOSE;
n = libwebsocket_write(wsi, n = libwebsocket_write(wsi,
&wsi->u.ws.ping_payload_buf[ &wsi->u.ws.ping_payload_buf[
LWS_SEND_BUFFER_PRE_PADDING], LWS_SEND_BUFFER_PRE_PADDING],
wsi->u.ws.ping_payload_len, wsi->u.ws.ping_payload_len,
LWS_WRITE_PONG); write_type);
if (n < 0) if (n < 0)
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment