mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +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 {
|
||||
// port: port.unwrap_or(project.serve_port),
|
||||
// server_id,
|
||||
// project: project.clone(),
|
||||
// start_time: Instant::now(),
|
||||
// };
|
||||
|
||||
// println!("Server listening on port {}", web_config.port);
|
||||
|
||||
// web::start(web_config);
|
||||
let web_config = web::WebConfig {
|
||||
port: port.unwrap_or(project.serve_port),
|
||||
server_id,
|
||||
start_time: Instant::now(),
|
||||
};
|
||||
|
||||
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());
|
||||
session.start();
|
||||
|
||||
loop {
|
||||
thread::park();
|
||||
}
|
||||
println!("Server listening on port {}", web_config.port);
|
||||
|
||||
web::start(web_config);
|
||||
|
||||
// loop {
|
||||
// thread::park();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,12 @@ use std::time::Instant;
|
|||
|
||||
use rouille;
|
||||
|
||||
use project::Project;
|
||||
use web_util::json_response;
|
||||
|
||||
/// The set of configuration the web server needs to start.
|
||||
pub struct WebConfig {
|
||||
pub port: u64,
|
||||
pub server_id: u64,
|
||||
pub project: Project,
|
||||
pub start_time: Instant,
|
||||
}
|
||||
|
||||
|
|
@ -19,13 +17,13 @@ struct ServerInfo<'a> {
|
|||
server_version: &'static str,
|
||||
protocol_version: u64,
|
||||
server_id: &'a str,
|
||||
project: &'a Project,
|
||||
current_time: f64,
|
||||
}
|
||||
|
||||
/// Start the Rojo web server and park our current thread.
|
||||
pub fn start(config: WebConfig) {
|
||||
let address = format!("localhost:{}", config.port);
|
||||
let server_version = env!("CARGO_PKG_VERSION");
|
||||
|
||||
let server_id = config.server_id.to_string();
|
||||
|
||||
|
|
@ -41,10 +39,9 @@ pub fn start(config: WebConfig) {
|
|||
};
|
||||
|
||||
json_response(ServerInfo {
|
||||
server_version: env!("CARGO_PKG_VERSION"),
|
||||
server_version,
|
||||
protocol_version: 2,
|
||||
server_id: &server_id,
|
||||
project: &config.project,
|
||||
current_time,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue