mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-16 12:02:11 +02:00
fix(websocket): Fixed Tx functions with DYNAMIC_BUFFER
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -550,9 +550,13 @@ static int esp_websocket_client_send_with_exact_opcode(esp_websocket_client_hand
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
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;
|
bool contained_fin = opcode & WS_TRANSPORT_OPCODES_FIN;
|
||||||
|
|
||||||
|
if (esp_websocket_new_buf(client, true) != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to setup tx buffer");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
@ -1226,11 +1230,7 @@ int esp_websocket_client_send_with_opcode(esp_websocket_client_handle_t client,
|
|||||||
ret = ESP_FAIL;
|
ret = ESP_FAIL;
|
||||||
goto unlock_and_return;
|
goto unlock_and_return;
|
||||||
}
|
}
|
||||||
if (esp_websocket_new_buf(client, true) != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Failed to setup tx buffer");
|
|
||||||
ret = ESP_FAIL;
|
|
||||||
goto unlock_and_return;
|
|
||||||
}
|
|
||||||
ret = esp_websocket_client_send_with_exact_opcode(client, opcode | WS_TRANSPORT_OPCODES_FIN, data, len, timeout);
|
ret = esp_websocket_client_send_with_exact_opcode(client, opcode | WS_TRANSPORT_OPCODES_FIN, data, len, timeout);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ESP_LOGE(TAG, "Failed to send the buffer");
|
ESP_LOGE(TAG, "Failed to send the buffer");
|
||||||
|
Reference in New Issue
Block a user