… | |
… | |
148 | alnumbits pack "nna*", $$ & 0xffff, time & 0xffff, nonce 2 |
148 | alnumbits pack "nna*", $$ & 0xffff, time & 0xffff, nonce 2 |
149 | } |
149 | } |
150 | |
150 | |
151 | our $CONFIG; # this node's configuration |
151 | our $CONFIG; # this node's configuration |
152 | |
152 | |
153 | our $RUNIQ = alnumbits nonce 96/8; # remote uniq value |
153 | our $RUNIQ; # remote uniq value |
154 | our $UNIQ = gen_uniq; # per-process/node unique cookie |
154 | our $UNIQ; # per-process/node unique cookie |
155 | our $NODE = "anon/$RUNIQ"; |
155 | our $NODE; |
156 | our $ID = "a"; |
156 | our $ID = "a"; |
157 | |
157 | |
158 | our %NODE; # node id to transport mapping, or "undef", for local node |
158 | our %NODE; # node id to transport mapping, or "undef", for local node |
159 | our (%PORT, %PORT_DATA); # local ports |
159 | our (%PORT, %PORT_DATA); # local ports |
160 | |
160 | |
161 | our %RMON; # local ports monitored by remote nodes ($RMON{nodeid}{portid} == cb) |
161 | our %RMON; # local ports monitored by remote nodes ($RMON{nodeid}{portid} == cb) |
… | |
… | |
163 | |
163 | |
164 | our %LISTENER; |
164 | our %LISTENER; |
165 | our $LISTENER; # our listeners, as arrayref |
165 | our $LISTENER; # our listeners, as arrayref |
166 | |
166 | |
167 | our $SRCNODE; # holds the sending node during _inject |
167 | our $SRCNODE; # holds the sending node during _inject |
|
|
168 | |
|
|
169 | sub _seed { |
|
|
170 | $RUNIQ = alnumbits nonce 96/8; |
|
|
171 | $UNIQ = gen_uniq; |
|
|
172 | $NODE = "anon/$RUNIQ"; |
|
|
173 | } |
|
|
174 | |
|
|
175 | _seed; |
168 | |
176 | |
169 | sub NODE() { |
177 | sub NODE() { |
170 | $NODE |
178 | $NODE |
171 | } |
179 | } |
172 | |
180 | |
… | |
… | |
378 | |
386 | |
379 | sub configure(@) { |
387 | sub 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 | |