… | |
… | |
557 | }; |
557 | }; |
558 | |
558 | |
559 | ############################################################################# |
559 | ############################################################################# |
560 | # keepalive code - used to kepe conenctions to certain nodes alive |
560 | # keepalive code - used to kepe conenctions to certain nodes alive |
561 | # only used by global code atm., but ought to be exposed somehow. |
561 | # only used by global code atm., but ought to be exposed somehow. |
|
|
562 | #TODO: should probbaly be done directly by node objects |
562 | |
563 | |
563 | our $KEEPALIVE_RETRY; |
564 | our $KEEPALIVE_RETRY; |
564 | our $KEEPALIVE_WATCHER; |
565 | our $KEEPALIVE_WATCHER; |
565 | our %KEEPALIVE; # we want to keep these nodes alive |
566 | our %KEEPALIVE; # we want to keep these nodes alive |
566 | our %KEEPALIVE_DOWN; # nodes that are down currently |
567 | our %KEEPALIVE_DOWN; # nodes that are down currently |
… | |
… | |
780 | } |
781 | } |
781 | |
782 | |
782 | sub db_del($@) { |
783 | sub db_del($@) { |
783 | my $family = shift; |
784 | my $family = shift; |
784 | |
785 | |
|
|
786 | my @del = grep exists $LOCAL_DB{$family}{$_}, @_; |
|
|
787 | |
|
|
788 | return unless @del; |
|
|
789 | |
785 | delete @{ $LOCAL_DB{$family} }{@_}; |
790 | delete @{ $LOCAL_DB{$family} }{@del}; |
786 | snd $MASTER, g_upd => $family => undef, \@_ |
791 | snd $MASTER, g_upd => $family => undef, \@del |
787 | if defined $MASTER; |
792 | if defined $MASTER; |
788 | } |
793 | } |
789 | |
794 | |
790 | # database query |
795 | # database query |
791 | |
796 | |
… | |
… | |
1079 | |
1084 | |
1080 | AE::log 8 => "node listens on [@$BINDS]."; |
1085 | AE::log 8 => "node listens on [@$BINDS]."; |
1081 | |
1086 | |
1082 | # connect to all seednodes |
1087 | # connect to all seednodes |
1083 | set_seeds map $_->recv, map _resolve $_, @$seeds; |
1088 | set_seeds map $_->recv, map _resolve $_, @$seeds; |
1084 | |
|
|
1085 | master_search; |
1089 | master_search; |
1086 | |
1090 | |
1087 | # save gobs of memory |
1091 | # save gobs of memory |
1088 | undef &_resolve; |
1092 | undef &_resolve; |
1089 | *configure = sub (@){ }; |
1093 | *configure = sub (@){ }; |