Skip to content
  • Fabrice Bellet's avatar
    stun timer: fix timeout of the last retransmission · f6f704c5
    Fabrice Bellet authored and Olivier Crête's avatar Olivier Crête committed
    According to RFC 5389, section 7.2.1, a special timeout is applied to
    the last retransmission (Rm * RTO), with Rm default value of 16, instead
    of (64 * RTO), 2^6 when the number of transmissions Rc is set to 7.
    
    As spotted by Olivier Crete, stun_timer_* is a public API, that cannot
    be changed, and the initial delay (RTO) is not preserved in the
    stun_timer_s struct. So we use a hack that implicitely guess Rm from the
    number of transmissions Rc, by generalizing the default value of the
    spec for Rm and Rc to other values of Rc passed in stun_timer_start(
    
    According to the spec, with the default value of Rc=7, the last delay
    should be (64 * RTO), and it is instead (16 * RTO). So the last delay
    can be computed by dividing the penultimate delay by two, instead of
    multiplying it by two.
    
    Differential Revision: https://phabricator.freedesktop.org/D1108
    f6f704c5