Skip to content

Commit

Permalink
UNIX socket support enabled only on UNIX systems
Browse files Browse the repository at this point in the history
On Windows fall back to using TCP socket
  • Loading branch information
Wiezzel committed Feb 10, 2021
1 parent 2417ea5 commit c455946
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ ya-service-api-interfaces = { path = "core/serv-api/interfaces" }
ya-service-api-web = { path = "core/serv-api/web" }

## SERVICE BUS
ya-service-bus = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "13f81460b994a48cebc9f242aa7a394f021b60d1"}
ya-sb-proto = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "13f81460b994a48cebc9f242aa7a394f021b60d1"}
ya-sb-router = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "13f81460b994a48cebc9f242aa7a394f021b60d1"}
ya-sb-util = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "13f81460b994a48cebc9f242aa7a394f021b60d1"}
ya-service-bus = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "322b6274369c4ec91b6912fa9daa53bd7a7a60a8" }
ya-sb-proto = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "322b6274369c4ec91b6912fa9daa53bd7a7a60a8" }
ya-sb-router = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "322b6274369c4ec91b6912fa9daa53bd7a7a60a8" }
ya-sb-util = { git = "https://github.com/golemfactory/ya-service-bus.git", rev = "322b6274369c4ec91b6912fa9daa53bd7a7a60a8" }

## CLIENT
ya-client = { git = "https://github.com/golemfactory/ya-client.git", rev = "4099adb99dadbc8929caba33538806f5e10d5920"}
Expand Down
16 changes: 14 additions & 2 deletions core/serv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use ya_version::VersionService;

mod autocomplete;
use autocomplete::CompleteCommand;
use ya_utils_path::SecurePath;

lazy_static::lazy_static! {
static ref DEFAULT_DATA_DIR: String = DataDir::new(clap::crate_name!()).to_string();
Expand Down Expand Up @@ -72,7 +71,7 @@ struct CliArgs {
)]
data_dir: DataDir,

/// Service Bus (aka GSB) URL [default: "unix:<YAGNA_DATADIR>/yagna.sock"]
/// Service Bus (aka GSB) URL [default: "unix:<YAGNA_DATADIR>/yagna.sock" or ]
#[structopt(
short,
long,
Expand All @@ -95,7 +94,10 @@ impl CliArgs {
self.data_dir.get_or_create()
}

#[cfg(unix)]
pub fn get_gsb_url(&self) -> Result<Url> {
use ya_utils_path::SecurePath;

if let Some(url) = &self.gsb_url {
return Ok(url.clone());
}
Expand All @@ -108,6 +110,16 @@ impl CliArgs {
Ok(format!("unix:{}", path_str).parse()?)
}

#[cfg(not(unix))]
pub fn get_gsb_url(&self) -> Result<Url> {
use ya_sb_proto::DEFAULT_GSB_URL;

if let Some(url) = &self.gsb_url {
return Ok(url.clone());
}
return Ok(DEFAULT_GSB_URL.parse()?);
}

pub async fn run_command(self) -> Result<()> {
let ctx: CliCtx = (&self).try_into()?;

Expand Down

0 comments on commit c455946

Please sign in to comment.