mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-16 12:02:11 +02:00
fix: continuation after FIN in websocket client (#460)
This commit is contained in:
@ -551,9 +551,14 @@ static int esp_websocket_client_send_with_exact_opcode(esp_websocket_client_hand
|
|||||||
int need_write = len;
|
int need_write = len;
|
||||||
int wlen = 0, widx = 0;
|
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
|
while (widx < len || opcode) { // allow for sending "current_opcode" only message with len==0
|
||||||
if (need_write > client->buffer_size) {
|
if (need_write > client->buffer_size) {
|
||||||
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);
|
memcpy(client->tx_buffer, data + widx, need_write);
|
||||||
// send with ws specific way and specific opcode
|
// send with ws specific way and specific opcode
|
||||||
|
Reference in New Issue
Block a user