fix async std test and make windows test script work

This commit is contained in:
John Smith 2023-09-06 09:53:28 -04:00
parent 4b298f43d4
commit 8d694f20cd
3 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
@echo off @echo off
cargo test -- --nocapture cargo test -- --nocapture
cargo test --features=rt-async-std -- --nocapture cargo test --no-default-features --features=default-async-std -- --nocapture

View File

@ -134,9 +134,8 @@ impl Network {
#[cfg(all(feature = "rt-async-std", unix))] #[cfg(all(feature = "rt-async-std", unix))]
{ {
// async-std does not directly support linger on tcpsocket yet // async-std does not directly support linger on TcpStream yet
use std::os::fd::AsRawFd; use std::os::fd::{AsRawFd, FromRawFd};
use std::os::fd::FromRawFd;
if let Err(e) = unsafe { socket2::Socket::from_raw_fd(tcp_stream.as_raw_fd()) } if let Err(e) = unsafe { socket2::Socket::from_raw_fd(tcp_stream.as_raw_fd()) }
.set_linger(Some(core::time::Duration::from_secs(0))) .set_linger(Some(core::time::Duration::from_secs(0)))
{ {
@ -146,9 +145,9 @@ impl Network {
} }
#[cfg(all(feature = "rt-async-std", windows))] #[cfg(all(feature = "rt-async-std", windows))]
{ {
// async-std does not directly support linger on tcpsocket yet // async-std does not directly support linger on TcpStream yet
use std::os::windows::io::AsRawSocket; use std::os::windows::io::{AsRawSocket, FromRawSocket};
if let Err(e) = unsafe { socket2::socket_from_raw(tcp_stream.as_raw_socket()) } if let Err(e) = unsafe { socket2::Socket::from_raw_socket(tcp_stream.as_raw_socket()) }
.set_linger(Some(core::time::Duration::from_secs(0))) .set_linger(Some(core::time::Duration::from_secs(0)))
{ {
log_net!(debug "Couldn't set TCP linger: {}", e); log_net!(debug "Couldn't set TCP linger: {}", e);

View File

@ -1,5 +1,5 @@
@echo off @echo off
cargo test --features=rt-tokio,tracing -- --nocapture cargo test --features=tracing -- --nocapture
cargo test --features=rt-async-std,tracing -- --nocapture cargo test --no-default-features --features=rt-async-std,tracing -- --nocapture
cargo test --features=rt-tokio -- --nocapture cargo test -- --nocapture
cargo test --features=rt-async-std -- --nocapture cargo test --no-default-features --features=rt-async-std -- --nocapture