Skip to content

Commit

Permalink
fix: continuation after FIN in websocket client (espressif#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFEEDC0DE64 committed Dec 19, 2023
1 parent 82c2cf8 commit 774d1c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/esp_websocket_client/esp_websocket_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,14 @@ static int esp_websocket_client_send_with_exact_opcode(esp_websocket_client_hand
int need_write = len;
int wlen = 0, widx = 0;

bool contained_fin = opcode & WS_TRANSPORT_OPCODES_FIN;

while (widx < len || opcode) { // allow for sending "current_opcode" only message with len==0
if (need_write > client->buffer_size) {
need_write = client->buffer_size;
opcode = opcode & ~WS_TRANSPORT_OPCODES_FIN;
} else if (contained_fin) {
opcode = opcode | WS_TRANSPORT_OPCODES_FIN;
}
memcpy(client->tx_buffer, data + widx, need_write);
// send with ws specific way and specific opcode
Expand Down

0 comments on commit 774d1c7

Please sign in to comment.