Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ pub fn server_mode() -> Result<(), Box<dyn Error + Sync + Send>> {

// Create the transport. Includes the stdio (stdin and stdout) versions but this could
// also be implemented to use sockets or HTTP.
let (connection, io_threads) = Connection::stdio();
// let (connection, io_threads) = Connection::stdio();
let (connection, io_threads) = Connection::listen("localhost:12345")?;

let (connection_id, initialization_params) = connection.initialize_start()?;

Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ pub fn main_loop(
}
}
}
Ok(())
Err("main loop ended".into())
}
24 changes: 17 additions & 7 deletions crates/tsls/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// initial the logger
// flexi_logger::Logger::try_with_env_or_str("debug")?.start()?;
let _logger = Logger::try_with_str("debug")?
.log_to_file(FileSpec::default())
// .log_to_file(FileSpec::default())
.write_mode(WriteMode::BufferAndFlush)
.start()?;
// .start()
Expand All @@ -37,12 +37,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
cli::setup(args.setup);
}

match args.mode.as_str() {
"server" => {
server_mode().unwrap();
Ok(())
loop {
match args.mode.as_str() {
"server" => {
match server_mode() {
Ok(()) => {
warn!("shutting down gracefully");
return Ok(());
}
Err(e) => {
// warn and restart server
warn!("{}, restart server", e);
}
};
}
"headless" => unimplemented!("headless mode"),
_ => unimplemented!("unknown mode"),
}
"headless" => unimplemented!("headless mode"),
_ => unimplemented!("unknown mode"),
}
}