mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
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: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
f1b125442b
commit
82eccf7611
1 changed files with 6 additions and 1 deletions
|
@ -55,6 +55,7 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
|
|||
#endif
|
||||
int ret;
|
||||
int m;
|
||||
int write_type = LWS_WRITE_PONG;
|
||||
|
||||
/* pending truncated sends have uber priority */
|
||||
|
||||
|
@ -94,11 +95,15 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
|
|||
|
||||
if (wsi->state == WSI_STATE_ESTABLISHED &&
|
||||
wsi->u.ws.ping_pending_flag) {
|
||||
|
||||
if (wsi->u.ws.payload_is_close)
|
||||
write_type = LWS_WRITE_CLOSE;
|
||||
|
||||
n = libwebsocket_write(wsi,
|
||||
&wsi->u.ws.ping_payload_buf[
|
||||
LWS_SEND_BUFFER_PRE_PADDING],
|
||||
wsi->u.ws.ping_payload_len,
|
||||
LWS_WRITE_PONG);
|
||||
write_type);
|
||||
if (n < 0)
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue