mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-05 20:35:08 +02:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user