Revision c8236a50 proto/bgp/bgp.c

View differences:

proto/bgp/bgp.c
399 399
}
400 400

  
401 401
void
402
bgp_start_ms_timer(timer *t, uint value)
402
bgp_start_ms_timer(timer *t, uint value, uint jitter)
403 403
{
404 404
    if (value)
405 405
    {
406 406
        /* The randomization procedure is specified in RFC 4271 section 10 */
407 407
        btime time = value MS;
408
        btime randomize = random() % ((time / 20) + 1);
408
        if(jitter > 100){
409
            jitter = 25;
410
        } else if(jitter == 0) {
411
            jitter = 1;
412
        }
413
        int divisor = 100 / jitter;
414
        log(L_INFO "divisor: %d", divisor);
415
        btime randomize = random() % ((time / divisor) + 1);
409 416
        log(L_INFO "Timer avviato con un delay di %d ms", time - randomize);
410 417
        tm_start(t, time - randomize);
411 418
    }

Also available in: Unified diff