Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
node: Expand `target_os` condition for keep-alive
Lorenz Leutgeb committed 8 days ago
commit 224c03daf1d040da83084928e9a1fe978a5a06ae
parent 4a81673
1 file changed +35 -5
modified crates/radicle-node/src/wire.rs
@@ -1193,11 +1193,41 @@ fn session<G: Ecdh<Pk = NodeId>>(
    {
        let connection = socket2::SockRef::from(&connection);

-
        let ka = socket2::TcpKeepalive::new()
-
            .with_time(time::Duration::from_secs(30))
-
            .with_interval(time::Duration::from_secs(10));
-

-
        #[cfg(not(windows))]
+
        let ka = socket2::TcpKeepalive::new().with_time(time::Duration::from_secs(30));
+

+
        #[cfg(any(
+
            target_os = "android",
+
            target_os = "dragonfly",
+
            target_os = "freebsd",
+
            target_os = "fuchsia",
+
            target_os = "illumos",
+
            target_os = "ios",
+
            target_os = "visionos",
+
            target_os = "linux",
+
            target_os = "macos",
+
            target_os = "netbsd",
+
            target_os = "tvos",
+
            target_os = "watchos",
+
            target_os = "windows",
+
            target_os = "cygwin",
+
        ))]
+
        let ka = ka.with_interval(time::Duration::from_secs(10));
+

+
        #[cfg(any(
+
            target_os = "android",
+
            target_os = "dragonfly",
+
            target_os = "freebsd",
+
            target_os = "fuchsia",
+
            target_os = "illumos",
+
            target_os = "ios",
+
            target_os = "visionos",
+
            target_os = "linux",
+
            target_os = "macos",
+
            target_os = "netbsd",
+
            target_os = "tvos",
+
            target_os = "watchos",
+
            target_os = "cygwin",
+
        ))]
        let ka = ka.with_retries(3);

        if let Err(e) = connection.set_tcp_keepalive(&ka) {