fn log_connection_gap_time_stats(
    sender: &mut CobaltSender,
    connect_stats: &ConnectStats,
) -> Option<ReconnectInfo> {
    if connect_stats.result != ConnectResult::Success {
        return None;
    }

    let ssid = match &connect_stats.candidate_network {
        Some(network) => network.bss.ssid(),
        None => {
            warn!("No candidate_network in successful connect stats");
            return None;
        }
    };

    let mut reconnect_info = None;
    if let Some(previous_disconnect_info) = &connect_stats.previous_disconnect_info {
        let duration = connect_stats.connect_end_at - previous_disconnect_info.disconnect_at;
        let ssids_dim = if ssid == &previous_disconnect_info.ssid {
            metrics::ConnectionGapTimeBreakdownMetricDimensionSsids::SameSsid
        } else {
            metrics::ConnectionGapTimeBreakdownMetricDimensionSsids::DifferentSsids
        };
        let previous_disconnect_cause_dim =
            convert_disconnect_source(&previous_disconnect_info.disconnect_source);

        sender.log_elapsed_time(metrics::CONNECTION_GAP_TIME_METRIC_ID, (), duration.into_micros());
        sender.log_elapsed_time(
            metrics::CONNECTION_GAP_TIME_BREAKDOWN_METRIC_ID,
            [ssids_dim as u32, previous_disconnect_cause_dim as u32],
            duration.into_micros(),
        );
        reconnect_info.replace(ReconnectInfo {
            gap_time: duration,
            same_ssid: ssid == &previous_disconnect_info.ssid,
        });
    }
    reconnect_info
}
/// If there was a reconnect, log connection gap time stats to Cobalt. Return the duration
/// and whether the reconnect was to the same SSID as last connected.
If there was a reconnect, log connection gap time stats to Cobalt. Return the duration
and whether the reconnect was to the same SSID as last connected.
If there was a reconnect log connection gap time stats to Cobalt . Return the duration and whether the reconnect was to the same SSID as last connected .
fn log_connection_gap_time_stats(
    sender: &mut CobaltSender,
    connect_stats: &ConnectStats,
) -> Option<ReconnectInfo> {
    if connect_stats.result != ConnectResult::Success {
        return None;
    }
    let ssid = match &connect_stats.candidate_network {
        Some(network) => network.bss.ssid(),
        None => {
            warn!("No candidate_network in successful connect stats");
            return None;
        }
    };
    let mut reconnect_info = None;
    if let Some(previous_disconnect_info) = &connect_stats.previous_disconnect_info {
        let duration = connect_stats.connect_end_at - previous_disconnect_info.disconnect_at;
        let ssids_dim = if ssid == &previous_disconnect_info.ssid {
            metrics::ConnectionGapTimeBreakdownMetricDimensionSsids::SameSsid
        } else {
            metrics::ConnectionGapTimeBreakdownMetricDimensionSsids::DifferentSsids
        };
        let previous_disconnect_cause_dim =
            convert_disconnect_source(&previous_disconnect_info.disconnect_source);
        sender.log_elapsed_time(metrics::CONNECTION_GAP_TIME_METRIC_ID, (), duration.into_micros());
        sender.log_elapsed_time(
            metrics::CONNECTION_GAP_TIME_BREAKDOWN_METRIC_ID,
            [ssids_dim as u32, previous_disconnect_cause_dim as u32],
            duration.into_micros(),
        );
        reconnect_info.replace(ReconnectInfo {
            gap_time: duration,
            same_ssid: ssid == &previous_disconnect_info.ssid,
        });
    }
    reconnect_info
}
fn log_connection_gap_time_stats ( sender : & mut CobaltSender , connect_stats : & ConnectStats , ) -> Option < ReconnectInfo > { if connect_stats . result != ConnectResult :: Success { return None ; } let ssid = match & connect_stats . candidate_network { Some ( network ) => network . bss . ssid ( ) , None => { warn ! ( " " ) ; return None ; } } ; let mut reconnect_info = None ; if let Some ( previous_disconnect_info ) = & connect_stats . previous_disconnect_info { let duration = connect_stats . connect_end_at - previous_disconnect_info . disconnect_at ; let ssids_dim = if ssid == & previous_disconnect_info . ssid { metrics :: ConnectionGapTimeBreakdownMetricDimensionSsids :: SameSsid } else { metrics :: ConnectionGapTimeBreakdownMetricDimensionSsids :: DifferentSsids } ; let previous_disconnect_cause_dim = convert_disconnect_source ( & previous_disconnect_info . disconnect_source ) ; sender . log_elapsed_time ( metrics :: CONNECTION_GAP_TIME_METRIC_ID , ( ) , duration . into_micros ( ) ) ; sender . log_elapsed_time ( metrics :: CONNECTION_GAP_TIME_BREAKDOWN_METRIC_ID , [ ssids_dim as u32 , previous_disconnect_cause_dim as u32 ] , duration . into_micros ( ) , ) ; reconnect_info . replace ( ReconnectInfo { gap_time : duration , same_ssid : ssid == & previous_disconnect_info . ssid , } ) ; } reconnect_info }
If there was a reconnect, log connection gap time stats to Cobalt.
If there was a reconnect log connection gap time stats to Cobalt .
sender
&mut CobaltSender
connect_stats
&ConnectStats
sender
&mut CobaltSender
connect_stats
&ConnectStats