Support optional addr in accept

This commit is contained in:
Aode (Lion) 2022-02-24 12:03:52 -06:00
parent 01847a1c44
commit 66bd357fa8
2 changed files with 9 additions and 9 deletions

14
Cargo.lock generated
View file

@ -57,20 +57,20 @@ source = "git+https://git.asonix.dog/safe-async/join-all#640069c1cbf5195ace220bd
[[package]]
name = "libc"
version = "0.2.118"
version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]]
name = "linux-raw-sys"
version = "0.0.40"
version = "0.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bdc16c6ce4c85d9b46b4e66f2a814be5b3f034dbd5131c268a24ca26d970db8"
checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7"
[[package]]
name = "polldance"
version = "0.1.0"
source = "git+https://git.asonix.dog/safe-async/polldance#0a155a37ae143c416db30939732d68faa643b71f"
source = "git+https://git.asonix.dog/safe-async/polldance#43222ec6236fd2ae01ebd1b01f81a386d153490c"
dependencies = [
"rustix",
]
@ -82,9 +82,9 @@ source = "git+https://git.asonix.dog/safe-async/read-write-buf#c3a7fc23ed51f12d3
[[package]]
name = "rustix"
version = "0.33.2"
version = "0.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db890a96e64911e67fa84e58ce061a40a6a65c231e5fad20b190933f8991a27c"
checksum = "a9466f25b92a648960ac1042fd3baa6b0bf285e60f754d7e5070770c813a177a"
dependencies = [
"bitflags",
"errno",

View file

@ -70,7 +70,7 @@ impl Async<TcpListener> {
.map(Async::new)
}
pub async fn accept(&self) -> Result<(Async<TcpStream>, SocketAddrAny)> {
pub async fn accept(&self) -> Result<(Async<TcpStream>, Option<SocketAddrAny>)> {
let (stream, addr) = Accept { io: &self.io }.await?;
Ok((Async::new(stream), addr))
@ -270,7 +270,7 @@ where
}
impl<'a> Future for Accept<'a> {
type Output = Result<(TcpStream, SocketAddrAny)>;
type Output = Result<(TcpStream, Option<SocketAddrAny>)>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
poll_nonblocking!(self.io.try_accept());