kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/http_client_select_read_error' into 'master'
fix(tcp_tranport): Fix handling of select() return value Closes IDFGH-13821 See merge request espressif/esp-idf!33985pull/14997/head
commit
fcd706066a
|
@ -174,7 +174,10 @@ static int base_poll_read(esp_transport_handle_t t, int timeout_ms)
|
|||
return remain;
|
||||
}
|
||||
ret = select(ssl->sockfd + 1, &readset, NULL, &errset, esp_transport_utils_ms_to_timeval(timeout_ms, &timeout));
|
||||
if (ret > 0 && FD_ISSET(ssl->sockfd, &errset)) {
|
||||
// The select() function monitors the socket for readiness to read or write, and checks for errors.
|
||||
// If both an error (errset) and readiness (readset/writeset) are detected simultaneously,
|
||||
// this code ensures that the pending read data must be handled before we start processing error.
|
||||
if (ret == 1 && FD_ISSET(ssl->sockfd, &errset)) {
|
||||
int sock_errno = 0;
|
||||
uint32_t optlen = sizeof(sock_errno);
|
||||
getsockopt(ssl->sockfd, SOL_SOCKET, SO_ERROR, &sock_errno, &optlen);
|
||||
|
|
Ładowanie…
Reference in New Issue