Skip to content

Commit 2289c95

Browse files
authored
Merge pull request #26 from second-state/chore/update_dependencies
2 parents 65b18e2 + c22bfe3 commit 2289c95

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
target = "wasm32-wasi"
3+
rustflags = ["--cfg", "wasmedge", "--cfg", "tokio_unstable"]

Cargo.toml

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ name = "order_demo_service"
33
version = "0.1.0"
44
edition = "2021"
55

6+
[patch.crates-io]
7+
tokio = { git = "https://github.com/second-state/wasi_tokio.git", branch = "v1.36.x" }
8+
socket2 = { git = "https://github.com/second-state/socket2.git", branch = "v0.5.x" }
9+
hyper = { git = "https://github.com/second-state/wasi_hyper.git", branch = "v0.14.x" }
10+
611
[dependencies]
712
anyhow = "1.0"
813
serde_json = "1.0"
914
serde = { version = "1.0", features = ["derive"] }
1015
url = "2.3"
11-
mysql_async_wasi = "=0.31.5"
12-
hyper_wasi = { version = "0.15", features = ["full"] }
13-
tokio_wasi = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }
16+
17+
mysql_async = { version = "0.34", default-features=false, features = [ "default-rustls" ], git="https://github.com/blackbeam/mysql_async.git" }
18+
zstd-sys = "=2.0.9"
19+
hyper = { version = "0.14", features = ["full"] }
20+
tokio = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }

src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
225225
let pool = Pool::new(builder.pool_opts(pool_opts));
226226

227227
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
228+
let tcp_listener = tokio::net::TcpListener::bind(addr).await.unwrap();
228229
let make_svc = make_service_fn(|_| {
229230
let pool = pool.clone();
230231
async move {
@@ -234,7 +235,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
234235
}))
235236
}
236237
});
237-
let server = Server::bind(&addr).serve(make_svc);
238+
let server = Server::from_tcp(tcp_listener.into_std().unwrap()).unwrap().serve(make_svc);
238239
if let Err(e) = server.await {
239240
eprintln!("server error: {}", e);
240241
}

0 commit comments

Comments
 (0)