async fn tls_client_handshake(
        &self,
        peer_id: NodeId,
        client_type: TransportClientType,
        flow_tag: FlowTag,
        stream: TcpStream,
    ) -> Result<(), TransportErrorCode> {
        let registry_version = *self.registry_version.read().unwrap();
        let local_addr = Self::sock_addr(stream.local_addr())?;
        let peer_addr = Self::sock_addr(stream.peer_addr())?;
        let (tls_reader, tls_writer) = self
            .crypto
            .perform_tls_client_handshake(stream, peer_id, registry_version)
            .await
            .map(|tls_stream| tls_stream.split())
            .map_err(|e| {
                self.control_plane_metrics
                    .tcp_client_handshake_failed
                    .with_label_values(&[&flow_tag.to_string()])
                    .inc();
                warn!(
                    every_n_seconds => 30,
                    self.log,
                    "ControlPlane::tls_client_handshake(): failed \
                     node_id = {:?} local_addr = {:?} peer_addr = {:?}, flow = {:?} error = {:?}",
                    self.node_id,
                    local_addr,
                    peer_addr,
                    flow_tag,
                    e
                );
                TransportErrorCode::PeerTlsInfoNotFound
            })?;

        self.process_handshake_result(
            peer_id,
            client_type,
            flow_tag,
            local_addr,
            peer_addr,
            tls_reader,
            tls_writer,
        )
        .await
        .map(|_| {
            self.control_plane_metrics
                .tcp_client_handshake_success
                .with_label_values(&[&flow_tag.to_string()])
                .inc()
        })
    }
/// Performs the client side TLS hand shake processing
Performs the client side TLS hand shake processing
Performs the client side TLS hand shake processing
async fn tls_client_handshake(
        &self,
        peer_id: NodeId,
        client_type: TransportClientType,
        flow_tag: FlowTag,
        stream: TcpStream,
    ) -> Result<(), TransportErrorCode> {
        let registry_version = *self.registry_version.read().unwrap();
        let local_addr = Self::sock_addr(stream.local_addr())?;
        let peer_addr = Self::sock_addr(stream.peer_addr())?;
        let (tls_reader, tls_writer) = self
            .crypto
            .perform_tls_client_handshake(stream, peer_id, registry_version)
            .await
            .map(|tls_stream| tls_stream.split())
            .map_err(|e| {
                self.control_plane_metrics
                    .tcp_client_handshake_failed
                    .with_label_values(&[&flow_tag.to_string()])
                    .inc();
                warn!(
                    every_n_seconds => 30,
                    self.log,
                    "ControlPlane::tls_client_handshake(): failed \
                     node_id = {:?} local_addr = {:?} peer_addr = {:?}, flow = {:?} error = {:?}",
                    self.node_id,
                    local_addr,
                    peer_addr,
                    flow_tag,
                    e
                );
                TransportErrorCode::PeerTlsInfoNotFound
            })?;
        self.process_handshake_result(
            peer_id,
            client_type,
            flow_tag,
            local_addr,
            peer_addr,
            tls_reader,
            tls_writer,
        )
        .await
        .map(|_| {
            self.control_plane_metrics
                .tcp_client_handshake_success
                .with_label_values(&[&flow_tag.to_string()])
                .inc()
        })
    }
async fn tls_client_handshake ( & self , peer_id : NodeId , client_type : TransportClientType , flow_tag : FlowTag , stream : TcpStream , ) -> Result < ( ) , TransportErrorCode > { let registry_version = * self . registry_version . read ( ) . unwrap ( ) ; let local_addr = Self :: sock_addr ( stream . local_addr ( ) ) ? ; let peer_addr = Self :: sock_addr ( stream . peer_addr ( ) ) ? ; let ( tls_reader , tls_writer ) = self . crypto . perform_tls_client_handshake ( stream , peer_id , registry_version ) . await . map ( | tls_stream | tls_stream . split ( ) ) . map_err ( | e | { self . control_plane_metrics . tcp_client_handshake_failed . with_label_values ( & [ & flow_tag . to_string ( ) ] ) . inc ( ) ; warn ! ( every_n_seconds 30 self log " \
 " self node_id local_addr peer_addr flow_tag e ) ; TransportErrorCode :: PeerTlsInfoNotFound } ) ? ; self . process_handshake_result ( peer_id , client_type , flow_tag , local_addr , peer_addr , tls_reader , tls_writer , ) . await . map ( | _ | { self . control_plane_metrics . tcp_client_handshake_success . with_label_values ( & [ & flow_tag . to_string ( ) ] ) . inc ( ) } ) }
Performs the client side TLS hand shake processing
Performs the client side TLS hand shake processing
&self
peer_id
NodeId
client_type
TransportClientType
flow_tag
FlowTag
stream
TcpStream
&self
peer_id
NodeId
client_type
TransportClientType
flow_tag
FlowTag
stream
TcpStream