Skip to content

Commit

Permalink
feat(server): implement AsRawFd for AddrStream (#2246)
Browse files Browse the repository at this point in the history
Fixes #2245.
  • Loading branch information
tedsta authored Jul 16, 2020
1 parent 4216b2d commit b5d5e21
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ mod addr_stream {
use bytes::{Buf, BufMut};
use std::io;
use std::net::SocketAddr;
#[cfg(unix)]
use std::os::unix::io::{AsRawFd, RawFd};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpStream;

Expand Down Expand Up @@ -288,4 +290,11 @@ mod addr_stream {
Pin::new(&mut self.inner).poll_shutdown(cx)
}
}

#[cfg(unix)]
impl AsRawFd for AddrStream {
fn as_raw_fd(&self) -> RawFd {
self.inner.as_raw_fd()
}
}
}

0 comments on commit b5d5e21

Please sign in to comment.