Perform various optimizations #173
3 changed files with 39 additions and 24 deletions
33
Cargo.lock
generated
33
Cargo.lock
generated
|
@ -1798,15 +1798,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "interprocess"
|
||||
version = "1.2.1"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81f2533f3be42fffe3b5e63b71aeca416c1c3bc33e4e27be018521e76b1f38fb"
|
||||
checksum = "7b4d0250d41da118226e55b3d50ca3f0d9e0a0f6829b92f543ac0054aeea1572"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"rustc_version",
|
||||
"to_method",
|
||||
"winapi",
|
||||
"recvmsg",
|
||||
"widestring",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2093,9 +2092,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|||
|
||||
[[package]]
|
||||
name = "minijinja"
|
||||
version = "1.0.21"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e"
|
||||
checksum = "7165d0e94806d52ad5295e4b54a95176d831814840bc067298ca647e1c956338"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -2765,6 +2764,12 @@ version = "0.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f"
|
||||
|
||||
[[package]]
|
||||
name = "recvmsg"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.4.1"
|
||||
|
@ -3540,12 +3545,6 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "to_method"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.37.0"
|
||||
|
@ -4178,6 +4177,12 @@ dependencies = [
|
|||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
|
|
@ -18,10 +18,10 @@ druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "b
|
|||
druid-widget-nursery = "0.1"
|
||||
dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" }
|
||||
futures = "0.3.25"
|
||||
interprocess = { version = "1.2.1", default-features = false }
|
||||
interprocess = "2.1.0"
|
||||
lazy_static = "1.4.0"
|
||||
luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" }
|
||||
minijinja = "1.0.10"
|
||||
minijinja = { version = "2.0.1", default-features = false }
|
||||
nexusmods = { path = "../../lib/nexusmods", version = "*" }
|
||||
oodle = { path = "../../lib/oodle", version = "*" }
|
||||
open = "5.0.1"
|
||||
|
|
|
@ -11,7 +11,7 @@ use clap::{command, value_parser, Arg};
|
|||
use color_eyre::eyre::{self, Context};
|
||||
use color_eyre::{Report, Result, Section};
|
||||
use druid::AppLauncher;
|
||||
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||
use interprocess::local_socket::{prelude::*, GenericNamespaced, ListenerOptions};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::controller::worker::work_thread;
|
||||
|
@ -29,9 +29,9 @@ mod util {
|
|||
}
|
||||
mod ui;
|
||||
|
||||
// As explained in https://docs.rs/interprocess/latest/interprocess/local_socket/enum.NameTypeSupport.html
|
||||
// As explained in https://docs.rs/interprocess/2.1.0/interprocess/local_socket/struct.Name.html
|
||||
// namespaces are supported on both platforms we care about: Windows and Linux.
|
||||
const IPC_ADDRESS: &str = "@dtmm.sock";
|
||||
const IPC_ADDRESS: &str = "dtmm.sock";
|
||||
|
||||
#[tracing::instrument]
|
||||
fn notify_nxm_download(
|
||||
|
@ -42,7 +42,11 @@ fn notify_nxm_download(
|
|||
|
||||
tracing::debug!("Received Uri '{}', sending to main process.", uri.as_ref());
|
||||
|
||||
let mut stream = LocalSocketStream::connect(IPC_ADDRESS)
|
||||
let mut stream = LocalSocketStream::connect(
|
||||
IPC_ADDRESS
|
||||
.to_ns_name::<GenericNamespaced>()
|
||||
.expect("Invalid socket name"),
|
||||
)
|
||||
.wrap_err_with(|| format!("Failed to connect to '{}'", IPC_ADDRESS))
|
||||
.suggestion("Make sure the main window is open.")?;
|
||||
|
||||
|
@ -130,8 +134,14 @@ fn main() -> Result<()> {
|
|||
let _guard = span.enter();
|
||||
|
||||
let event_sink = event_sink.clone();
|
||||
let server =
|
||||
LocalSocketListener::bind(IPC_ADDRESS).wrap_err("Failed to create IPC listener")?;
|
||||
let server = ListenerOptions::new()
|
||||
.name(
|
||||
IPC_ADDRESS
|
||||
.to_ns_name::<GenericNamespaced>()
|
||||
.expect("Invalid socket name"),
|
||||
)
|
||||
.create_sync()
|
||||
.wrap_err("Failed to create IPC listener")?;
|
||||
|
||||
tracing::debug!("IPC server listening on '{}'", IPC_ADDRESS);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue