/// Sets up the client side socket with the node IP address
Sets up the client side socket with the node IP address
Sets up the client side socket with the node IP address
fn init_client_socket(
        local_addr: &SocketAddr,
        log: &ReplicaLogger,
    ) -> Result<TcpSocket, TransportErrorCode> {
        let socket = if local_addr.is_ipv6() {
            TcpSocket::new_v6()
        } else {
            TcpSocket::new_v4()
        };
        let socket = match socket {
            Ok(socket) => socket,
            Err(e) => {
                warn!(
                    every_n_seconds => 30,
                    log,
                    "ControlPlane::connect(): Failed to create socket: local_addr = {:?} {:?}",
                    local_addr,
                    e
                );
                return Err(TransportErrorCode::ClientSocketCreateFailed);
            }
        };
        match socket.bind(*local_addr) {
            Ok(()) => Ok(socket),
            Err(e) => {
                warn!(
                    every_n_seconds => 30,
                    log,
                    "ControlPlane::connect(): Failed to bind(): local_addr = {:?} {:?}",
                    local_addr,
                    e
                );
                Err(TransportErrorCode::ClientSocketBindFailed)
            }
        }
    }
fn init_client_socket ( local_addr : & SocketAddr , log : & ReplicaLogger , ) -> Result < TcpSocket , TransportErrorCode > { let socket = if local_addr . is_ipv6 ( ) { TcpSocket :: new_v6 ( ) } else { TcpSocket :: new_v4 ( ) } ; let socket = match socket { Ok ( socket ) => socket , Err ( e ) => { warn ! ( every_n_seconds 30 log " " local_addr e ) ; return Err ( TransportErrorCode :: ClientSocketCreateFailed ) ; } } ; match socket . bind ( * local_addr ) { Ok ( ( ) ) => Ok ( socket ) , Err ( e ) => { warn ! ( every_n_seconds 30 log " " local_addr e ) ; Err ( TransportErrorCode :: ClientSocketBindFailed ) } } }
Sets up the client side socket with the node IP address
Sets up the client side socket with the node IP address
local_addr
&SocketAddr
log
&ReplicaLogger