… | |
… | |
503 | ; |
503 | ; |
504 | } |
504 | } |
505 | |
505 | |
506 | sub seed_all { |
506 | sub seed_all { |
507 | my @seeds = grep |
507 | my @seeds = grep |
508 | !exists $SEED_CONNECT{$_} |
|
|
509 | && !(defined $SEED_NODE{$_} && node_is_up $SEED_NODE{$_}), |
508 | !(defined $SEED_NODE{$_} && node_is_up $SEED_NODE{$_}), |
510 | keys %SEED_NODE; |
509 | keys %SEED_NODE; |
511 | |
510 | |
512 | if (@seeds) { |
511 | if (@seeds) { |
513 | # start connection attempt for every seed we are not connected to yet |
512 | # start connection attempt for every seed we are not connected to yet |
514 | seed_connect $_ |
513 | seed_connect $_ |
515 | for @seeds; |
514 | for grep !exists $SEED_CONNECT{$_}, @seeds; |
516 | |
515 | |
517 | $SEED_RETRY = $SEED_RETRY * 2; |
516 | $SEED_RETRY = $SEED_RETRY * 2; |
518 | $SEED_RETRY = $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout} |
517 | $SEED_RETRY = $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout} |
519 | if $SEED_RETRY > $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout}; |
518 | if $SEED_RETRY > $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout}; |
520 | |
519 | |
… | |
… | |
526 | } |
525 | } |
527 | } |
526 | } |
528 | |
527 | |
529 | sub seed_again { |
528 | sub seed_again { |
530 | $SEED_RETRY = (1 + rand) * 0.6; |
529 | $SEED_RETRY = (1 + rand) * 0.6; |
531 | $SEED_WATCHER ||= AE::timer $SEED_RETRY, 0, \&seed_all; |
530 | $SEED_WATCHER ||= AE::timer 0, 0, \&seed_all; |
532 | } |
531 | } |
533 | |
532 | |
534 | # sets new seed list, starts connecting |
533 | # sets new seed list, starts connecting |
535 | sub set_seeds(@) { |
534 | sub set_seeds(@) { |
536 | %SEED_NODE = (); |
535 | %SEED_NODE = (); |