a second instance on one machine: its own data, its own peer port, and a join that says itself again when it was never seated

This commit is contained in:
KeelrLeek committed 2026-09-03 13:39:06 -05:00
1 parent 67e52697b2
commit 6f7452c803
17 files changed
+125 -56

No files matched your search

+9 -4
View File
@@ -148,15 +148,18 @@ struct NodeDirs {
base: PathBuf,
config: PathBuf,
data: PathBuf,
/// The client API port this peer must listen on — the same one the
/// adapter dials. Left implicit, a second instance's peer takes the
/// default and quietly binds the first instance's port.
ws_port: u16,
}
fn node_dirs(app: &tauri::AppHandle) -> Result<NodeDirs, String> {
let base = app
.path()
.app_data_dir()
let base = crate::paths::app_data(app)
.map_err(|e| e.to_string())?
.join("freenet");
Ok(NodeDirs { config: base.join("config"), data: base.join("data"), base })
let ws_port = config::load(app).freenet_ws_port.unwrap_or(freenet_adapter::DEFAULT_WS_PORT);
Ok(NodeDirs { config: base.join("config"), data: base.join("data"), base, ws_port })
}
/// No console window for child processes on Windows.
@@ -224,6 +227,8 @@ fn spawn_node(bin: &Path, dirs: &NodeDirs, log: &Path) -> Result<Child, String>
.arg(&dirs.config)
.arg("--data-dir")
.arg(&dirs.data)
.arg("--ws-api-port")
.arg(dirs.ws_port.to_string())
.stdin(Stdio::null())
.stdout(Stdio::from(out))
.stderr(Stdio::from(err))