fn init_std_listener(
        &self,
        local_addr: &SockAddr,
    ) -> Result<StdTcpListener, TransportErrorCode> {
        let domain = Self::socket_domain(local_addr);
        let socket = Socket::new(domain, Type::stream(), None).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to create socket: local_addr = {:?} {:?}",
                local_addr,
                e
            );
            TransportErrorCode::ServerSocketCreateFailed
        })?;

        socket
            .set_reuse_address(true)
            .map_err(|_| TransportErrorCode::ServerSocketAddrReuseFailed)?;

        socket
            .set_reuse_port(true)
            .map_err(|_| TransportErrorCode::ServerSocketPortReuseFailed)?;

        socket.bind(&local_addr).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to bind: local_addr = {:?} {:?}", local_addr, e
            );
            TransportErrorCode::ServerSocketBindFailed
        })?;

        socket.listen(ACCEPT_BACKLOG).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to listen: local_addr = {:?} {:?}", local_addr, e
            );
            TransportErrorCode::ServerSocketListenFailed
        })?;

        Ok(socket.into_tcp_listener())
    }
/// Sets up the server side socket with the node IP:port
Sets up the server side socket with the node IP:port
Sets up the server side socket with the node IP : port
fn init_std_listener(
        &self,
        local_addr: &SockAddr,
    ) -> Result<StdTcpListener, TransportErrorCode> {
        let domain = Self::socket_domain(local_addr);
        let socket = Socket::new(domain, Type::stream(), None).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to create socket: local_addr = {:?} {:?}",
                local_addr,
                e
            );
            TransportErrorCode::ServerSocketCreateFailed
        })?;
        socket
            .set_reuse_address(true)
            .map_err(|_| TransportErrorCode::ServerSocketAddrReuseFailed)?;
        socket
            .set_reuse_port(true)
            .map_err(|_| TransportErrorCode::ServerSocketPortReuseFailed)?;
        socket.bind(&local_addr).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to bind: local_addr = {:?} {:?}", local_addr, e
            );
            TransportErrorCode::ServerSocketBindFailed
        })?;
        socket.listen(ACCEPT_BACKLOG).map_err(|e| {
            warn!(
                every_n_seconds => 30,
                self.log,
                "ControlPlane::listen(): Failed to listen: local_addr = {:?} {:?}", local_addr, e
            );
            TransportErrorCode::ServerSocketListenFailed
        })?;
        Ok(socket.into_tcp_listener())
    }
fn init_std_listener ( & self , local_addr : & SockAddr , ) -> Result < StdTcpListener , TransportErrorCode > { let domain = Self :: socket_domain ( local_addr ) ; let socket = Socket :: new ( domain , Type :: stream ( ) , None ) . map_err ( | e | { warn ! ( every_n_seconds 30 self log " " local_addr e ) ; TransportErrorCode :: ServerSocketCreateFailed } ) ? ; socket . set_reuse_address ( true ) . map_err ( | _ | TransportErrorCode :: ServerSocketAddrReuseFailed ) ? ; socket . set_reuse_port ( true ) . map_err ( | _ | TransportErrorCode :: ServerSocketPortReuseFailed ) ? ; socket . bind ( & local_addr ) . map_err ( | e | { warn ! ( every_n_seconds 30 self log " " local_addr e ) ; TransportErrorCode :: ServerSocketBindFailed } ) ? ; socket . listen ( ACCEPT_BACKLOG ) . map_err ( | e | { warn ! ( every_n_seconds 30 self log " " local_addr e ) ; TransportErrorCode :: ServerSocketListenFailed } ) ? ; Ok ( socket . into_tcp_listener ( ) ) }
Sets up the server side socket with the node IP:port
Sets up the server side socket with the node IP : port
&self
local_addr
&SockAddr
&self
local_addr
&SockAddr