pub async fn shared_accept(&self) -> Result<AcceptedTcpStream> {
        let reactor = self.reactor.upgrade().unwrap();
        let raw_fd = self.listener.as_raw_fd();
        if let Some(r) = yolo_accept(raw_fd) {
            match r {
                Ok(fd) => {
                    return Ok(AcceptedTcpStream { fd });
                }
                Err(err) => return Err(GlommioError::IoError(err)),
            }
        }
        let source = reactor.accept(self.listener.as_raw_fd());
        let fd = source.collect_rw().await?;
        Ok(AcceptedTcpStream { fd: fd as RawFd })
    }
/// Accepts a new incoming TCP connection and allows the result to be sent
/// to a foreign executor
///
/// This is similar to [`accept`], except it returns an
/// [`AcceptedTcpStream`] instead of a [`TcpStream`].
/// [`AcceptedTcpStream`] implements [`Send`], so it can be safely sent
/// for processing over a shared channel to a different executor.
///
/// This is useful when the user wants to do her own load balancing across
/// multiple executors instead of relying on the load balancing the OS
/// would do with the ReusePort property of the bound socket.
///
/// # Examples
///
/// ```no_run
/// use glommio::{net::TcpListener, LocalExecutor};
///
/// let ex = LocalExecutor::default();
/// ex.run(async move {
///     let listener = TcpListener::bind("127.0.0.1:8000").unwrap();
///     let stream = listener.shared_accept().await.unwrap();
/// });
/// ```
///
/// [`accept`]: TcpListener::accept
/// [`AcceptedTcpStream`]: struct.AcceptedTcpStream.html
/// [`TcpStream`]: struct.TcpStream.html
/// [`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
Accepts a new incoming TCP connection and allows the result to be sent
to a foreign executor



This is useful when the user wants to do her own load balancing across
multiple executors instead of relying on the load balancing the OS
would do with the ReusePort property of the bound socket.
Accepts a new incoming TCP connection and allows the result to be sent to a foreign executor This is useful when the user wants to do her own load balancing across multiple executors instead of relying on the load balancing the OS would do with the ReusePort property of the bound socket .
pub async fn shared_accept(&self) -> Result<AcceptedTcpStream> {
        let reactor = self.reactor.upgrade().unwrap();
        let raw_fd = self.listener.as_raw_fd();
        if let Some(r) = yolo_accept(raw_fd) {
            match r {
                Ok(fd) => {
                    return Ok(AcceptedTcpStream { fd });
                }
                Err(err) => return Err(GlommioError::IoError(err)),
            }
        }
        let source = reactor.accept(self.listener.as_raw_fd());
        let fd = source.collect_rw().await?;
        Ok(AcceptedTcpStream { fd: fd as RawFd })
    }
pub async fn shared_accept ( & self ) -> Result < AcceptedTcpStream > { let reactor = self . reactor . upgrade ( ) . unwrap ( ) ; let raw_fd = self . listener . as_raw_fd ( ) ; if let Some ( r ) = yolo_accept ( raw_fd ) { match r { Ok ( fd ) => { return Ok ( AcceptedTcpStream { fd } ) ; } Err ( err ) => return Err ( GlommioError :: IoError ( err ) ) , } } let source = reactor . accept ( self . listener . as_raw_fd ( ) ) ; let fd = source . collect_rw ( ) . await ? ; Ok ( AcceptedTcpStream { fd : fd as RawFd } ) }
Accepts a new incoming TCP connection and allows the result to be sent
to a foreign executor
Accepts a new incoming TCP connection and allows the result to be sent to a foreign executor
&self
&self
examples
```no_run
use glommio::{net::TcpListener, LocalExecutor}.

let ex = LocalExecutor::default();
ex.run(async move {
let listener = TcpListener::bind("127.0.0.1:8000").unwrap();
let stream = listener.shared_accept().await.unwrap();
});
```


` ` ` no_run use glommio :: { net :: TcpListener LocalExecutor } . let ex = LocalExecutor :: default () ; ex . run ( async move { let listener = TcpListener :: bind ( " 127 . 0 . 0 . 1 : 8000 " ) . unwrap () ; let stream = listener . shared_accept () . await . unwrap () ; } ) ; ` ` `