tcp_transport: ws fix on reception of longer data than receive buffer

pull/3236/head
David Cermak 2019-02-02 18:35:22 +01:00
rodzic f05228be36
commit 5141e0ec24
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -230,15 +230,17 @@ static int ws_read(esp_transport_handle_t t, char *buffer, int len, int timeout_
data_ptr += 8;
payload_len_buff = len - 10;
}
if (payload_len > payload_len_buff) {
ESP_LOGD(TAG, "Actual data to receive (%d) are longer than ws buffer (%d)", payload_len, payload_len_buff);
payload_len = payload_len_buff;
}
// Then receive and process payload
if ((rlen = esp_transport_read(ws->parent, data_ptr, payload_len, timeout_ms)) <= 0) {
ESP_LOGE(TAG, "Error read data");
return rlen;
}
if (payload_len > payload_len_buff) {
ESP_LOGD(TAG, "Actual data received (%d) are longer than mqtt buffer (%d)", payload_len, payload_len_buff);
payload_len = payload_len_buff;
}
if (mask) {
mask_key = data_ptr;