From a3582c922e29953a3cca4cc892a3923e1fe1a75b Mon Sep 17 00:00:00 2001 From: Tricster Date: Fri, 3 Feb 2023 17:33:44 +0800 Subject: [PATCH] Update DNS resolvement. Signed-off-by: Tricster --- Cargo.toml | 2 +- src/client/connect/dns.rs | 8 ++++---- src/server/server.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa7a77f69b..5bbd919ae6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ want = "0.3" libc = { version = "0.2", optional = true } socket2 = { version = "0.4.7", optional = true, features = ["all"] } -wasmedge_wasi_socket = {version = "0.4.2", optional = true } +wasmedge_wasi_socket = {version = "0.4.3", optional = true } [dev-dependencies] futures-util = { version = "0.3", default-features = false, features = ["alloc"] } diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs index 5b02c6ad2e..d8e8801a1d 100644 --- a/src/client/connect/dns.rs +++ b/src/client/connect/dns.rs @@ -32,7 +32,7 @@ use std::str::FromStr; use std::task::{self, Poll}; use std::{fmt, io, vec}; #[cfg(target_os = "wasi")] -use wasmedge_wasi_socket::{nslookup, SocketAddr}; +use wasmedge_wasi_socket::{SocketAddr, ToSocketAddrs}; use tokio::task::JoinHandle; use tower_service::Service; @@ -133,9 +133,9 @@ impl Service for GaiResolver { #[cfg(target_os = "wasi")] let blocking = tokio::task::spawn(async move { debug!("resolving host={:?}", name.host); - nslookup(&*name.host, "http").map(|i| SocketAddrs { - iter: i.into_iter(), - }) + (&*name.host, 0) + .to_socket_addrs() + .map(|i| SocketAddrs { iter: i }) }); GaiFuture { inner: blocking } } diff --git a/src/server/server.rs b/src/server/server.rs index c541953b61..ad002e0e10 100644 --- a/src/server/server.rs +++ b/src/server/server.rs @@ -5,8 +5,8 @@ use std::net::{SocketAddr, TcpListener as StdTcpListener}; #[cfg(all(feature = "tcp", target_os = "wasi"))] use wasmedge_wasi_socket::{SocketAddr, TcpListener as StdTcpListener}; -// #[cfg(feature = "tcp")] -// use std::time::Duration; +#[cfg(feature = "tcp")] +use std::time::Duration; use pin_project_lite::pin_project;