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 9b85020697f216ef9291eeaf62189afc3ebbcfd0
parent a670b6e668761ea5893b7d343b4515b888712f14
1 passed 1 pending (2 total) View logs
3 files changed +37 -3
added crates/radicle/CHANGELOG.md
@@ -0,0 +1,24 @@
+
# Changelog
+

+
All notable changes to this project will be documented in this file.
+

+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+

+
## [Unreleased]
+

+
### Added
+

+
### Changed
+

+
- `radicle::profile::Home::socket` defaults to the path `\\.\pipe\radicle-node`
+
  on Windows. The behavior on Unix-like systems has *not* changed.
+

+
### Deprecated
+

+
### Removed
+

+
- `radicle::node::DEFAULT_SOCKET_NAME`, use `radicle::profile::Home::socket`
+
  instead.
+

+
### Security
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.