Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle/profile: Control socket path for Windows
◌ CI pending Lorenz Leutgeb committed 9 months ago
commit 61b1c234ac26eb9042509f2470f18c134c39e78c
parent a670b6e668761ea5893b7d343b4515b888712f14
1 passed 1 pending (2 total) View logs
2 files changed +13 -3
modified crates/radicle/src/node.rs
@@ -53,8 +53,6 @@ pub use timestamp::Timestamp;

/// Peer-to-peer protocol version.
pub const PROTOCOL_VERSION: u8 = 1;
-
/// Default name for control socket file.
-
pub const DEFAULT_SOCKET_NAME: &str = "control.sock";
/// Default radicle protocol port.
pub const DEFAULT_PORT: u16 = 8776;
/// Default timeout when waiting for the node to respond with data.
modified crates/radicle/src/profile.rs
@@ -578,9 +578,21 @@ impl Home {
    }

    pub fn socket(&self) -> PathBuf {
+
        #[cfg(unix)]
+
        const DEFAULT_SOCKET_NAME: &str = "control.sock";
+

+
        #[cfg(windows)]
+
        const DEFAULT_SOCKET_NAME: &str = r#"\\.\pipe\radicle-node"#;
+

        env::var_os(env::RAD_SOCKET)
            .map(PathBuf::from)
-
            .unwrap_or_else(|| self.node().join(node::DEFAULT_SOCKET_NAME))
+
            .unwrap_or_else(|| {
+
                #[cfg(unix)]
+
                return self.node().join(DEFAULT_SOCKET_NAME);
+

+
                #[cfg(windows)]
+
                return PathBuf::from(DEFAULT_SOCKET_NAME);
+
            })
    }

    /// Return a read-write handle to the notifications database.