Skip to content

Commit

Permalink
Salvo upgrade to 0.40 (#6324)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn authored May 1, 2023
1 parent 8c8207a commit a4c2799
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 3 additions & 9 deletions rust/salvo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ edition = "2021"
authors = ["Chrislearn Young <[email protected]>"]

[dependencies]
salvo = { version = "0.37", default-features = false }
salvo = { version = "0.40", default-features = false, features = ["http1"]}
tokio = { version = "1", features = ["full"] }

[profile.release]
opt-level = 3
debug = true
debug-assertions = false
overflow-checks = false
lto = true
panic = "abort"
incremental = false
opt-level = 3
codegen-units = 1
rpath = false
strip = false
panic = "abort"
12 changes: 5 additions & 7 deletions rust/salvo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ async fn main() {
.post(index)
.push(Router::with_path("<id>").filter(get()).handle(get_user)),
);
let service = Service::new(router);
salvo::hyper::Server::builder(TcpListener::bind("0.0.0.0:3000"))
.http1_only(true)
.http1_pipeline_flush(true)
.serve(service)
.await
.unwrap();
let acceptor = TcpListener::new("0.0.0.0:3000").bind().await;
let mut server = Server::new(acceptor);
let http1 = server.http1_mut();
http1.pipeline_flush(true);
server.serve(router).await
}

0 comments on commit a4c2799

Please sign in to comment.