ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Kernel.pm
(Generate patch)

Comparing AnyEvent-MP/MP/Kernel.pm (file contents):
Revision 1.103 by root, Fri Mar 23 03:24:41 2012 UTC vs.
Revision 1.104 by root, Fri Mar 23 13:44:01 2012 UTC

90 (int $now * 10000) % 62, 90 (int $now * 10000) % 62,
91 ) . nonce62 4; 91 ) . nonce62 4;
92} 92}
93 93
94our $CONFIG; # this node's configuration 94our $CONFIG; # this node's configuration
95our $SECURE = sub { 1 }; 95our $SECURE;
96 96
97our $RUNIQ; # remote uniq value 97our $RUNIQ; # remote uniq value
98our $UNIQ; # per-process/node unique cookie 98our $UNIQ; # per-process/node unique cookie
99our $NODE; 99our $NODE;
100our $ID = "a"; 100our $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
364sub _secure_check { 364sub _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
369our %NODE_REQ = ( 369our %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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines