dhcpcanon/timers.py
def gen_renewing_time(lease_time, elapsed=0):
    """Generate RENEWING time.

    [:rfc:`2131#section-4.4.5`]::

        T1
        defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *
        duration_of_lease).  Times T1 and T2 SHOULD be chosen with some
        random "fuzz" around a fixed value, to avoid synchronization of
        client reacquisition.

    """
    renewing_time = int(lease_time) * RENEW_PERC - elapsed
    # FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint
    # the implementation
    # NOTE: here using same "fuzz" as systemd?
    range_fuzz = int(lease_time) * REBIND_PERC - renewing_time
    logger.debug('rebinding fuzz range %s', range_fuzz)
    fuzz = random.uniform(-(range_fuzz),
                          +(range_fuzz))
    renewing_time += fuzz
    logger.debug('Renewing time %s.', renewing_time)
    return renewing_time
def gen_renewing_time(lease_time, elapsed=0):
    renewing_time = int(lease_time) * RENEW_PERC - elapsed
    # FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint
    # the implementation
    # NOTE: here using same "fuzz" as systemd?
    range_fuzz = int(lease_time) * REBIND_PERC - renewing_time
    logger.debug('rebinding fuzz range %s', range_fuzz)
    fuzz = random.uniform(-(range_fuzz),
                          +(range_fuzz))
    renewing_time += fuzz
    logger.debug('Renewing time %s.', renewing_time)
    return renewing_time
def gen_renewing_time ( lease_time , elapsed = 0 ) : renewing_time = int ( lease_time ) * RENEW_PERC - elapsed # FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint # the implementation # NOTE: here using same "fuzz" as systemd? range_fuzz = int ( lease_time ) * REBIND_PERC - renewing_time logger . debug ( 'rebinding fuzz range %s' , range_fuzz ) fuzz = random . uniform ( - ( range_fuzz ) , + ( range_fuzz ) ) renewing_time += fuzz logger . debug ( 'Renewing time %s.' , renewing_time ) return renewing_time
Generate RENEWING time.

    [:rfc:`2131#section-4.4.5`]::

        T1
        defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *
        duration_of_lease).  Times T1 and T2 SHOULD be chosen with some
        random "fuzz" around a fixed value, to avoid synchronization of
        client reacquisition.
Generate RENEWING time .