Merge pull request #461 from 0xFEEDC0DE64/fix-websocket-client-fin

fix(websocket): continuation after FIN in websocket client (#460) (IDFGH-11761)
This commit is contained in:
Suren
2023-12-22 14:45:51 +04:00
committed by GitHub

View File

@ -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