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.63 by root, Sat Nov 7 02:36:31 2009 UTC vs.
Revision 1.64 by root, Tue Dec 1 11:59:48 2009 UTC

148 alnumbits pack "nna*", $$ & 0xffff, time & 0xffff, nonce 2 148 alnumbits pack "nna*", $$ & 0xffff, time & 0xffff, nonce 2
149} 149}
150 150
151our $CONFIG; # this node's configuration 151our $CONFIG; # this node's configuration
152 152
153our $RUNIQ = alnumbits nonce 96/8; # remote uniq value 153our $RUNIQ; # remote uniq value
154our $UNIQ = gen_uniq; # per-process/node unique cookie 154our $UNIQ; # per-process/node unique cookie
155our $NODE = "anon/$RUNIQ"; 155our $NODE;
156our $ID = "a"; 156our $ID = "a";
157 157
158our %NODE; # node id to transport mapping, or "undef", for local node 158our %NODE; # node id to transport mapping, or "undef", for local node
159our (%PORT, %PORT_DATA); # local ports 159our (%PORT, %PORT_DATA); # local ports
160 160
161our %RMON; # local ports monitored by remote nodes ($RMON{nodeid}{portid} == cb) 161our %RMON; # local ports monitored by remote nodes ($RMON{nodeid}{portid} == cb)
163 163
164our %LISTENER; 164our %LISTENER;
165our $LISTENER; # our listeners, as arrayref 165our $LISTENER; # our listeners, as arrayref
166 166
167our $SRCNODE; # holds the sending node during _inject 167our $SRCNODE; # holds the sending node during _inject
168
169sub _seed {
170 $RUNIQ = alnumbits nonce 96/8;
171 $UNIQ = gen_uniq;
172 $NODE = "anon/$RUNIQ";
173}
174
175_seed;
168 176
169sub NODE() { 177sub NODE() {
170 $NODE 178 $NODE
171} 179}
172 180
378 386
379sub configure(@) { 387sub configure(@) {
380 unshift @_, "profile" if @_ & 1; 388 unshift @_, "profile" if @_ & 1;
381 my (%kv) = @_; 389 my (%kv) = @_;
382 390
391 delete $NODE{$NODE}; # we do not support doing stuff before configure
392 _seed;
393
383 my $profile = delete $kv{profile}; 394 my $profile = delete $kv{profile};
384 395
385 $profile = _nodename 396 $profile = _nodename
386 unless defined $profile; 397 unless defined $profile;
387 398
388 $CONFIG = AnyEvent::MP::Config::find_profile $profile, %kv; 399 $CONFIG = AnyEvent::MP::Config::find_profile $profile, %kv;
389
390 delete $NODE{$NODE}; # we do not support doing stuff before configure
391 400
392 my $node = exists $CONFIG->{nodeid} ? $CONFIG->{nodeid} : $profile; 401 my $node = exists $CONFIG->{nodeid} ? $CONFIG->{nodeid} : $profile;
393 402
394 $node or Carp::croak "$node: illegal node ID (see AnyEvent::MP manpage for syntax)\n"; 403 $node or Carp::croak "$node: illegal node ID (see AnyEvent::MP manpage for syntax)\n";
395 404

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines