tcp_transport: Extend transport error storage for socket error

Everytime we report error and log errno, we also capture the actual
errno to an internal storage so that user application can retrieve
its value.
This commit is contained in:
David Cermak
2020-04-08 20:04:33 +02:00
committed by bot
parent 1a35b5ac9b
commit ce519ee783
13 changed files with 251 additions and 86 deletions
@@ -313,7 +313,22 @@ esp_err_t esp_transport_set_parent_transport_func(esp_transport_handle_t t, payl
*/
esp_tls_error_handle_t esp_transport_get_error_handle(esp_transport_handle_t t);
/**
* @brief Get and clear last captured socket errno
*
* Socket errno is internally stored whenever any of public facing API
* for reading, writing, polling or connection fails returning negative return code.
* The error code corresponds to the `SO_ERROR` value retrieved from the underlying
* transport socket using `getsockopt()` API. After reading the captured errno,
* the internal value is cleared to 0.
*
* @param[in] t The transport handle
*
* @return
* - >=0 Last captured socket errno
* - -1 Invalid transport handle or invalid transport's internal error storage
*/
int esp_transport_get_errno(esp_transport_handle_t t);
#ifdef __cplusplus
}