mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Trim web server a bit and re-enable it
This commit is contained in:
parent
5bf3af57ab
commit
7bb148c0e7
2 changed files with 14 additions and 18 deletions
|
|
@ -26,16 +26,11 @@ pub fn serve(project_path: &PathBuf, port: Option<u64>) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// let web_config = web::WebConfig {
|
let web_config = web::WebConfig {
|
||||||
// port: port.unwrap_or(project.serve_port),
|
port: port.unwrap_or(project.serve_port),
|
||||||
// server_id,
|
server_id,
|
||||||
// project: project.clone(),
|
start_time: Instant::now(),
|
||||||
// start_time: Instant::now(),
|
};
|
||||||
// };
|
|
||||||
|
|
||||||
// println!("Server listening on port {}", web_config.port);
|
|
||||||
|
|
||||||
// web::start(web_config);
|
|
||||||
|
|
||||||
let mut partitions = HashMap::new();
|
let mut partitions = HashMap::new();
|
||||||
|
|
||||||
|
|
@ -59,7 +54,11 @@ pub fn serve(project_path: &PathBuf, port: Option<u64>) {
|
||||||
let mut session = Session::new(config.clone());
|
let mut session = Session::new(config.clone());
|
||||||
session.start();
|
session.start();
|
||||||
|
|
||||||
loop {
|
println!("Server listening on port {}", web_config.port);
|
||||||
thread::park();
|
|
||||||
}
|
web::start(web_config);
|
||||||
|
|
||||||
|
// loop {
|
||||||
|
// thread::park();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@ use std::time::Instant;
|
||||||
|
|
||||||
use rouille;
|
use rouille;
|
||||||
|
|
||||||
use project::Project;
|
|
||||||
use web_util::json_response;
|
use web_util::json_response;
|
||||||
|
|
||||||
/// The set of configuration the web server needs to start.
|
/// The set of configuration the web server needs to start.
|
||||||
pub struct WebConfig {
|
pub struct WebConfig {
|
||||||
pub port: u64,
|
pub port: u64,
|
||||||
pub server_id: u64,
|
pub server_id: u64,
|
||||||
pub project: Project,
|
|
||||||
pub start_time: Instant,
|
pub start_time: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,13 +17,13 @@ struct ServerInfo<'a> {
|
||||||
server_version: &'static str,
|
server_version: &'static str,
|
||||||
protocol_version: u64,
|
protocol_version: u64,
|
||||||
server_id: &'a str,
|
server_id: &'a str,
|
||||||
project: &'a Project,
|
|
||||||
current_time: f64,
|
current_time: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start the Rojo web server and park our current thread.
|
/// Start the Rojo web server and park our current thread.
|
||||||
pub fn start(config: WebConfig) {
|
pub fn start(config: WebConfig) {
|
||||||
let address = format!("localhost:{}", config.port);
|
let address = format!("localhost:{}", config.port);
|
||||||
|
let server_version = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
let server_id = config.server_id.to_string();
|
let server_id = config.server_id.to_string();
|
||||||
|
|
||||||
|
|
@ -41,10 +39,9 @@ pub fn start(config: WebConfig) {
|
||||||
};
|
};
|
||||||
|
|
||||||
json_response(ServerInfo {
|
json_response(ServerInfo {
|
||||||
server_version: env!("CARGO_PKG_VERSION"),
|
server_version,
|
||||||
protocol_version: 2,
|
protocol_version: 2,
|
||||||
server_id: &server_id,
|
server_id: &server_id,
|
||||||
project: &config.project,
|
|
||||||
current_time,
|
current_time,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue