diff --git a/Cargo.lock b/Cargo.lock index 7d7be3c6..12dcb3f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -591,9 +591,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.9" +version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83" +checksum = "7728a72c4c7d72665fde02204bcbd93b247721025b222ef78606f14513e0fd03" dependencies = [ "bytes", "futures-channel", @@ -745,9 +745,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.97" +version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" [[package]] name = "libmimalloc-sys" @@ -1815,7 +1815,7 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" version = "1.8.1" -source = "git+https://github.com/zonyitoo/tokio.git#6fa7de17f01c761acb34fa8b62c46ce5708208f0" +source = "git+https://github.com/zonyitoo/tokio.git#279c0ef3407bcf4e393183f75ba1c5927061c514" dependencies = [ "autocfg", "bytes", @@ -1844,7 +1844,7 @@ dependencies = [ [[package]] name = "tokio-macros" version = "1.3.0" -source = "git+https://github.com/zonyitoo/tokio.git#6fa7de17f01c761acb34fa8b62c46ce5708208f0" +source = "git+https://github.com/zonyitoo/tokio.git#279c0ef3407bcf4e393183f75ba1c5927061c514" dependencies = [ "proc-macro2", "quote", diff --git a/crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs b/crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs index 0394947d..ff8aa467 100644 --- a/crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs +++ b/crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs @@ -13,7 +13,7 @@ use log::error; use pin_project::pin_project; use socket2::SockAddr; use tokio::{ - io::{AsyncRead, AsyncWrite, ReadBuf}, + io::{AsyncRead, AsyncWrite, Interest, ReadBuf}, net::{TcpSocket, TcpStream as TokioTcpStream, UdpSocket}, }; @@ -126,7 +126,7 @@ impl AsyncWrite for TcpStream { ready!(stream.poll_write_ready(cx))?; let mut connecting = false; - let send_result = stream.try_write_io(|| { + let send_result = stream.try_io(Interest::WRITABLE, || { unsafe { let ret = libc::sendto( stream.as_raw_fd(), diff --git a/crates/shadowsocks/src/net/sys/unix/bsd/macos.rs b/crates/shadowsocks/src/net/sys/unix/bsd/macos.rs index 073b53f6..e29a50b7 100644 --- a/crates/shadowsocks/src/net/sys/unix/bsd/macos.rs +++ b/crates/shadowsocks/src/net/sys/unix/bsd/macos.rs @@ -14,7 +14,7 @@ use log::error; use pin_project::pin_project; use socket2::SockAddr; use tokio::{ - io::{AsyncRead, AsyncWrite, ReadBuf}, + io::{AsyncRead, AsyncWrite, Interest, ReadBuf}, net::{TcpSocket, TcpStream as TokioTcpStream, UdpSocket}, }; @@ -137,7 +137,7 @@ impl AsyncWrite for TcpStream { ready!(stream.poll_write_ready(cx))?; let mut connecting = false; - let send_result = stream.try_write_io(|| { + let send_result = stream.try_io(Interest::WRITABLE, || { unsafe { let ret = libc::send(stream.as_raw_fd(), buf.as_ptr() as *const libc::c_void, buf.len(), 0); if ret >= 0 { diff --git a/crates/shadowsocks/src/net/sys/unix/linux/mod.rs b/crates/shadowsocks/src/net/sys/unix/linux/mod.rs index 453a793f..310265a3 100644 --- a/crates/shadowsocks/src/net/sys/unix/linux/mod.rs +++ b/crates/shadowsocks/src/net/sys/unix/linux/mod.rs @@ -15,7 +15,7 @@ use log::error; use pin_project::pin_project; use socket2::SockAddr; use tokio::{ - io::{AsyncRead, AsyncWrite, ReadBuf}, + io::{AsyncRead, AsyncWrite, Interest, ReadBuf}, net::{TcpSocket, TcpStream as TokioTcpStream, UdpSocket}, }; @@ -197,7 +197,7 @@ impl AsyncWrite for TcpStream { ready!(stream.poll_write_ready(cx))?; let mut connecting = false; - let send_result = stream.try_write_io(|| { + let send_result = stream.try_io(Interest::WRITABLE, || { unsafe { let ret = libc::sendto( stream.as_raw_fd(), @@ -222,7 +222,7 @@ impl AsyncWrite for TcpStream { // So in this state. We have to loop again to call `poll_write` for sending the first packet. connecting = true; - // Let `try_write_io` clears the write readiness. + // Let `try_io` clears the write readiness. Err(ErrorKind::WouldBlock.into()) } else { // Other errors, including EAGAIN, EWOULDBLOCK @@ -258,7 +258,7 @@ impl AsyncWrite for TcpStream { ready!(stream.poll_write_ready(cx))?; let mut connecting = false; - let send_result = stream.try_write_io(|| { + let send_result = stream.try_io(Interest::WRITABLE, || { unsafe { let ret = libc::send(stream.as_raw_fd(), buf.as_ptr() as *const libc::c_void, buf.len(), 0); diff --git a/crates/shadowsocks/src/net/sys/windows/mod.rs b/crates/shadowsocks/src/net/sys/windows/mod.rs index e0c5ece5..c45cc3a0 100644 --- a/crates/shadowsocks/src/net/sys/windows/mod.rs +++ b/crates/shadowsocks/src/net/sys/windows/mod.rs @@ -15,7 +15,7 @@ use once_cell::sync::Lazy; use pin_project::pin_project; use socket2::{Domain, Protocol, SockAddr, Socket, Type}; use tokio::{ - io::{AsyncRead, AsyncWrite, ReadBuf}, + io::{AsyncRead, AsyncWrite, Interest, ReadBuf}, net::{TcpSocket, TcpStream as TokioTcpStream, UdpSocket}, }; use winapi::{ @@ -285,7 +285,7 @@ impl AsyncWrite for TcpStream { ready!(stream.poll_write_ready(cx))?; - let write_result = stream.try_write_io(|| { + let write_result = stream.try_io(Interest::WRITABLE, || { unsafe { let sock = stream.as_raw_socket() as SOCKET; @@ -316,7 +316,7 @@ impl AsyncWrite for TcpStream { if err == WSA_IO_INCOMPLETE { // ConnectEx is still not connected. Wait for the next round // - // Let `try_write_io` clears the write readiness. + // Let `try_io` clears the write readiness. Err(ErrorKind::WouldBlock.into()) } else { Err(io::Error::from_raw_os_error(err))