… | |
… | |
90 | (int $now * 10000) % 62, |
90 | (int $now * 10000) % 62, |
91 | ) . nonce62 4; |
91 | ) . nonce62 4; |
92 | } |
92 | } |
93 | |
93 | |
94 | our $CONFIG; # this node's configuration |
94 | our $CONFIG; # this node's configuration |
95 | our $SECURE = sub { 1 }; |
95 | our $SECURE; |
96 | |
96 | |
97 | our $RUNIQ; # remote uniq value |
97 | our $RUNIQ; # remote uniq value |
98 | our $UNIQ; # per-process/node unique cookie |
98 | our $UNIQ; # per-process/node unique cookie |
99 | our $NODE; |
99 | our $NODE; |
100 | our $ID = "a"; |
100 | our $ID = "a"; |
… | |
… | |
360 | delete $LMON{$_[1]}{$_[2]+0} |
360 | delete $LMON{$_[1]}{$_[2]+0} |
361 | if exists $LMON{$_[1]}; |
361 | if exists $LMON{$_[1]}; |
362 | } |
362 | } |
363 | |
363 | |
364 | sub _secure_check { |
364 | sub _secure_check { |
365 | &$SECURE |
365 | $SECURE |
366 | or die "remote execution attempt by insecure node\n"; |
366 | and die "secure mode caught remote execution attempt\n"; |
367 | } |
367 | } |
368 | |
368 | |
369 | our %NODE_REQ = ( |
369 | our %NODE_REQ = ( |
370 | # internal services |
370 | # internal services |
371 | |
371 | |
… | |
… | |
418 | "" => sub { |
418 | "" => sub { |
419 | # empty messages are keepalives or similar devnull-applications |
419 | # empty messages are keepalives or similar devnull-applications |
420 | }, |
420 | }, |
421 | ); |
421 | ); |
422 | |
422 | |
|
|
423 | # the node port |
423 | $NODE{""} = $NODE{$NODE} = new AnyEvent::MP::Node::Self $NODE; |
424 | $NODE{""} = $NODE{$NODE} = new AnyEvent::MP::Node::Self $NODE; |
424 | $PORT{""} = sub { |
425 | $PORT{""} = sub { |
425 | my $tag = shift; |
426 | my $tag = shift; |
426 | eval { &{ $NODE_REQ{$tag} ||= do { &_secure_check; load_func $tag } } }; |
427 | eval { &{ $NODE_REQ{$tag} ||= do { &_secure_check; load_func $tag } } }; |
427 | AE::log die => "error processing node message from $SRCNODE: $@" if $@; |
428 | AE::log die => "error processing node message from $SRCNODE: $@" if $@; |
… | |
… | |
943 | $profile = nodename |
944 | $profile = nodename |
944 | unless defined $profile; |
945 | unless defined $profile; |
945 | |
946 | |
946 | $CONFIG = AnyEvent::MP::Config::find_profile $profile, %kv; |
947 | $CONFIG = AnyEvent::MP::Config::find_profile $profile, %kv; |
947 | |
948 | |
948 | if (exists $CONFIG->{secure}) { |
949 | $SECURE = $CONFIG->{secure}; |
949 | $SECURE = eval +($CONFIG->{secure} ? "sub { 0 }" : "sub { 1 }"); |
|
|
950 | } |
|
|
951 | |
950 | |
952 | my $node = exists $CONFIG->{nodeid} ? $CONFIG->{nodeid} : "$profile/"; |
951 | my $node = exists $CONFIG->{nodeid} ? $CONFIG->{nodeid} : "$profile/"; |
953 | |
952 | |
954 | $node or Carp::croak "$node: illegal node ID (see AnyEvent::MP manpage for syntax)\n"; |
953 | $node or Carp::croak "$node: illegal node ID (see AnyEvent::MP manpage for syntax)\n"; |
955 | |
954 | |