fn validate_ingress_expiry<C: HttpRequestContent>(
    request: &HttpRequest<C>,
    current_time: Time,
) -> Result<(), RequestValidationError> {
    let ingress_expiry = request.ingress_expiry();
    let provided_expiry = Time::from_nanos_since_unix_epoch(ingress_expiry);
    let min_allowed_expiry = current_time;
    // We need to account for time drift and be more forgiving at rejecting ingress
    // messages due to their expiry being too far in the future.
    let max_allowed_expiry = min_allowed_expiry + MAX_INGRESS_TTL + PERMITTED_DRIFT_AT_VALIDATOR;
    if !(min_allowed_expiry <= provided_expiry && provided_expiry <= max_allowed_expiry) {
        let msg = format!(
            "Specified ingress_expiry not within expected range:\n\
             Minimum allowed expiry: {}\n\
             Maximum allowed expiry: {}\n\
             Provided expiry:        {}\n\
             Local replica time:     {}",
            min_allowed_expiry,
            max_allowed_expiry,
            provided_expiry,
            chrono::Utc::now(),
        );
        return Err(InvalidIngressExpiry(msg));
    }
    Ok(())
}
// Check if ingress_expiry is within a proper range with respect to the given
// time, i.e., it is not expired yet and is not too far in the future.
Check if ingress_expiry is within a proper range with respect to the given
time, i.e., it is not expired yet and is not too far in the future.
Check if ingress_expiry is within a proper range with respect to the given time i . e . it is not expired yet and is not too far in the future .
fn validate_ingress_expiry<C: HttpRequestContent>(
    request: &HttpRequest<C>,
    current_time: Time,
) -> Result<(), RequestValidationError> {
    let ingress_expiry = request.ingress_expiry();
    let provided_expiry = Time::from_nanos_since_unix_epoch(ingress_expiry);
    let min_allowed_expiry = current_time;
    // We need to account for time drift and be more forgiving at rejecting ingress
    // messages due to their expiry being too far in the future.
    let max_allowed_expiry = min_allowed_expiry + MAX_INGRESS_TTL + PERMITTED_DRIFT_AT_VALIDATOR;
    if !(min_allowed_expiry <= provided_expiry && provided_expiry <= max_allowed_expiry) {
        let msg = format!(
            "Specified ingress_expiry not within expected range:\n\
             Minimum allowed expiry: {}\n\
             Maximum allowed expiry: {}\n\
             Provided expiry:        {}\n\
             Local replica time:     {}",
            min_allowed_expiry,
            max_allowed_expiry,
            provided_expiry,
            chrono::Utc::now(),
        );
        return Err(InvalidIngressExpiry(msg));
    }
    Ok(())
}
fn validate_ingress_expiry < C : HttpRequestContent > ( request : & HttpRequest < C > , current_time : Time , ) -> Result < ( ) , RequestValidationError > { let ingress_expiry = request . ingress_expiry ( ) ; let provided_expiry = Time :: from_nanos_since_unix_epoch ( ingress_expiry ) ; let min_allowed_expiry = current_time ; // We need to account for time drift and be more forgiving at rejecting ingress // messages due to their expiry being too far in the future. let max_allowed_expiry = min_allowed_expiry + MAX_INGRESS_TTL + PERMITTED_DRIFT_AT_VALIDATOR ; if ! ( min_allowed_expiry <= provided_expiry && provided_expiry <= max_allowed_expiry ) { let msg = format ! ( " \n \
 \n \
 \n \
 \n \
 " min_allowed_expiry max_allowed_expiry provided_expiry chrono Utc now ( ) ) ; return Err ( InvalidIngressExpiry ( msg ) ) ; } Ok ( ( ) ) }
Check if ingress_expiry is within a proper range with respect to the given
time, i.e., it is not expired yet and is not too far in the future.
Check if ingress_expiry is within a proper range with respect to the given time i . e . it is not expired yet and is not too far in the future .
request
&HttpRequest<C>
current_time
Time
request
&HttpRequest<C>
current_time
Time