/// Listen for incoming connections on this socket.
///
/// Returns an error if the socket is not bound.
Listen for incoming connections on this socket.
Returns an error if the socket is not bound.
Listen for incoming connections on this socket . Returns an error if the socket is not bound .
fn listen(&self, socket: &Socket, backlog: i32) -> Result<(), Errno> {
        let mut inner = socket.lock();
        let is_bound = inner.address.is_some();
        let backlog = if backlog < 0 { 1024 } else { backlog as usize };
        match &mut inner.state {
            SocketState::Disconnected if is_bound => {
                inner.state = SocketState::Listening(AcceptQueue::new(backlog));
                Ok(())
            }
            SocketState::Listening(queue) => {
                queue.set_backlog(backlog)?;
                Ok(())
            }
            _ => error!(EINVAL),
        }
    }
fn listen ( & self , socket : & Socket , backlog : i32 ) -> Result < ( ) , Errno > { let mut inner = socket . lock ( ) ; let is_bound = inner . address . is_some ( ) ; let backlog = if backlog < 0 { 1024 } else { backlog as usize } ; match & mut inner . state { SocketState :: Disconnected if is_bound => { inner . state = SocketState :: Listening ( AcceptQueue :: new ( backlog ) ) ; Ok ( ( ) ) } SocketState :: Listening ( queue ) => { queue . set_backlog ( backlog ) ? ; Ok ( ( ) ) } _ => error ! ( EINVAL ) , } }
Listen for incoming connections on this socket.
Listen for incoming connections on this socket .
&self
socket
&Socket
backlog
i32