Hyper-util crate on xtensa

I'm trying to use hyper-util and hyper on esp32s3 but I have these errors, can anyone help me?

error[E0599]: no method named with_interval found for struct TcpKeepalive in the current scope
--> C:\Users\lpirc.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-util-0.1.5\src\client\legacy\connect\http.rs:114:12
|
114 | ka.with_interval(interval)
| ^^^^^^^^^^^^^ method not found in TcpKeepalive

error[E0599]: no method named with_retries found for struct TcpKeepalive in the current scope
--> C:\Users\lpirc.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-util-0.1.5\src\client\legacy\connect\http.rs:130:12
|
130 | ka.with_retries(retries)
| ^^^^^^^^^^^^ help: there is a method with a similar name: with_time

This looks like a bug in the platform configuration between hyper-util and socket2 to me. In the case of with_interval, hyper-util builds this function for your platform which calls socket2::TcpKeepalive::with_interval, which itself only works on certain OSes. Your platform seems to be a mismatch between the two crates (i.e. hyper-util believes it is okay to use socket2::TcpKeepalive::with_interval when building for your platform, but socket2 doesn't build that function for it, because it is not supported). I believe you should raise an issue for this with hyper-util, giving the exact information of the platform you are building for.

1 Like

I crated issues both on socket2 and hyper-rustls.
But the problem is that espidf is not suitable for these two methods, as can be seen below:

#[cfg(any(
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "tvos",
target_os = "watchos",
target_os = "windows"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "tvos",
target_os = "watchos",
target_os = "windows"
)))
)]
pub const fn with_interval(self, interval: Duration) -> Self {
Self {
interval: Some(interval),
..self
}
}

/// Set the value of the `TCP_KEEPCNT` option.
///
/// Set the maximum number of TCP keepalive probes that will be sent before
/// dropping a connection, if TCP keepalive is enabled on this socket.
#[cfg(all(
    feature = "all",
    any(
        target_os = "android",
        target_os = "dragonfly",
        target_os = "freebsd",
        target_os = "fuchsia",
        target_os = "illumos",
        target_os = "ios",
        target_os = "linux",
        target_os = "macos",
        target_os = "netbsd",
        target_os = "tvos",
        target_os = "watchos",
    )
))]
#[cfg_attr(
    docsrs,
    doc(cfg(all(
        feature = "all",
        any(
            target_os = "android",
            target_os = "dragonfly",
            target_os = "freebsd",
            target_os = "fuchsia",
            target_os = "illumos",
            target_os = "ios",
            target_os = "linux",
            target_os = "macos",
            target_os = "netbsd",
            target_os = "tvos",
            target_os = "watchos",
        )
    )))
)]
pub const fn with_retries(self, retries: u32) -> Self {
    Self {
        retries: Some(retries),
        ..self
    }
}

}

Yes, your patform should use the method that does not set the keepalive interval / retries, as it is not supported on the platform, but it doesn't, because hyper-util is wrongfully configured for your platform.

To anyone interested here are the issues:

hyper

socket2

1 Like