Skip to content

Commit

Permalink
Merge pull request #461 from 0xFEEDC0DE64/fix-websocket-client-fin
Browse files Browse the repository at this point in the history
fix(websocket): continuation after FIN in websocket client (#460) (IDFGH-11761)
  • Loading branch information
gabsuren authored Dec 22, 2023
2 parents a6845f4 + 774d1c7 commit aadda22
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 aadda22

Please sign in to comment.