STD support for the ESP-IDF framework
This commit is contained in:
parent
ae90dcf020
commit
459eaa6bae
29 changed files with 580 additions and 46 deletions
|
@ -9,7 +9,7 @@ use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr};
|
|||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::time::{Duration, Instant};
|
||||
|
||||
use libc::{c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK};
|
||||
use libc::{c_int, c_void, size_t, sockaddr, socklen_t, MSG_PEEK};
|
||||
|
||||
pub use crate::sys::{cvt, cvt_r};
|
||||
|
||||
|
@ -30,13 +30,19 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
|
|||
// We may need to trigger a glibc workaround. See on_resolver_failure() for details.
|
||||
on_resolver_failure();
|
||||
|
||||
if err == EAI_SYSTEM {
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
if err == libc::EAI_SYSTEM {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
let detail = unsafe {
|
||||
str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap().to_owned()
|
||||
};
|
||||
|
||||
#[cfg(target_os = "espidf")]
|
||||
let detail = "";
|
||||
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Uncategorized,
|
||||
&format!("failed to lookup address information: {}", detail)[..],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue