mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Keep obsolete view command monolith deleted after modular form port
This commit is contained in:
1 parent
a72296ee57
commit
5cafc0968d
4 files changed
+11
-1531
No files matched your search
@@ -19,8 +19,8 @@ use serde_json::{Value, json};
|
||||
/// Start serving a listener already bound during startup, before a window is opened.
|
||||
pub fn start(listener: TcpListener, token: String, ctx: egui::Context) -> Receiver<ControlRequest> {
|
||||
let (tx, rx) = channel::<ControlRequest>();
|
||||
let port=listener.local_addr().map_or(0,|a|a.port());
|
||||
eprintln!("photocraft: control server listening on {}",listening_addr(&listener,port));
|
||||
let port = listener.local_addr().map_or(0, |a| a.port());
|
||||
eprintln!("photocraft: control server listening on {}", listening_addr(&listener, port));
|
||||
std::thread::spawn(move || {
|
||||
let limiter = ConnectionLimiter::new(MAX_CONNECTIONS);
|
||||
let token = Arc::new(token);
|
||||
|
||||
@@ -292,9 +292,12 @@ fn control_setup(
|
||||
eprint!("{warning}");
|
||||
}
|
||||
let port = port?;
|
||||
let listener=match std::net::TcpListener::bind(("127.0.0.1",port)) {
|
||||
Ok(listener)=>listener,
|
||||
Err(error)=>{eprintln!("photocraft: control server failed to bind 127.0.0.1:{port}: {error}");std::process::exit(2);}
|
||||
let listener = match std::net::TcpListener::bind(("127.0.0.1", port)) {
|
||||
Ok(listener) => listener,
|
||||
Err(error) => {
|
||||
eprintln!("photocraft: control server failed to bind 127.0.0.1:{port}: {error}");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
let (supplied, token_file) = (auth.control_token, auth.control_token_file);
|
||||
let token = match photocraft_automation::security::server_token(supplied.as_deref(), token_file.as_deref()) {
|
||||
|
||||
@@ -58,8 +58,8 @@ fn run_with(args: &[&str], vars: &[(&str, &str)]) -> Run {
|
||||
let output = child.wait_with_output().unwrap();
|
||||
let gpu_started = dir.join("gpu-starting.json").exists();
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
assert!(!timed_out,"PhotoCraft did not exit: {}",String::from_utf8_lossy(&output.stderr));
|
||||
assert!(!gpu_started,"control setup errors must exit before GPU startup");
|
||||
assert!(!timed_out, "PhotoCraft did not exit: {}", String::from_utf8_lossy(&output.stderr));
|
||||
assert!(!gpu_started, "control setup errors must exit before GPU startup");
|
||||
Run { status: output.status, stderr: String::from_utf8_lossy(&output.stderr).into_owned() }
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ fn run_with(args: &[&str], vars: &[(&str, &str)]) -> Run {
|
||||
fn an_occupied_control_port_exits_with_status_2() {
|
||||
let held = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let port = held.local_addr().unwrap().port().to_string();
|
||||
let Run {status,stderr} = run_photocraft(&["--control", &port, "--control-token", VALID_TOKEN]);
|
||||
let Run { status, stderr } = run_photocraft(&["--control", &port, "--control-token", VALID_TOKEN]);
|
||||
assert_eq!(status.code(), Some(2), "occupied control port must exit 2, stderr: {stderr}");
|
||||
assert!(stderr.contains(&format!("failed to bind 127.0.0.1:{port}")), "stderr: {stderr}");
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user