* Initial:
*
* RT = IRT + RAND * IRT
+ * = IRT * (1 + RAND)
*/
scale = fr_rand();
scale -= ((fr_time_delta_t) 1) << 31; /* scale it -2^31..+2^31 */
return FR_RETRY_MRC;
}
+redo:
/*
* Cap delay at MRD
*/
* have to scale everything relative to that.
*
* RT = 2*RTprev + RAND*RTprev
- * = RTprev + (2 + RAND)
+ * = RTprev * (2 + RAND)
*/
scale = fr_rand();
scale -= ((fr_time_delta_t) 1) << 31; /* scale it -2^31..+2^31 */
/*
* Cap delay at MRT.
+ *
+ * RT = MRT + RAND * MRT
+ * = MRT * (1 + RAND)
*/
if (r->config->mrt && (rt > r->config->mrt)) {
scale = fr_rand();
*/
r->next += rt;
+ /*
+ * The "next" retransmission time is in the past, AND
+ * we're already halfway through the time after that.
+ * Skip this retransmission, and set the time for the
+ * next one.
+ *
+ * i.e. if we weren't serviced for one event, just skip
+ * it, and go to the next one.
+ */
+ if ((r->next + (rt / 2)) < now) goto redo;
+
return FR_RETRY_CONTINUE;
}