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

Comparing AnyEvent-MP/MP/Global.pm (file contents):
Revision 1.55 by root, Thu Mar 8 21:37:51 2012 UTC vs.
Revision 1.56 by root, Thu Mar 8 21:59:01 2012 UTC

217 snd $SRCNODE->{id}, g_chg1 => $_[0], $GLOBAL_DB{$_[0]}; 217 snd $SRCNODE->{id}, g_chg1 => $_[0], $GLOBAL_DB{$_[0]};
218}; 218};
219 219
220############################################################################# 220#############################################################################
221# switch to global mode 221# switch to global mode
222
223$GLOBAL = 1;
224$MASTER = $NODE;
225undef $GLOBAL_SLAVE{$NODE}; # we are our own master (and slave)
226 222
227# regularly try to connect to global nodes - maybe use seeding code? 223# regularly try to connect to global nodes - maybe use seeding code?
228$MASTER_TIMER = AE::timer 0, $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout}, sub { 224$MASTER_TIMER = AE::timer 0, $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout}, sub {
229 (add_node $_)->connect 225 (add_node $_)->connect
230 for keys %{ $GLOBAL_DB{"'g"} }; 226 for keys %{ $GLOBAL_DB{"'g"} };
292 g_slave_disconnect $SRCNODE->{id}; 288 g_slave_disconnect $SRCNODE->{id};
293 $SRCNODE->{transport}{remote_greeting}{global} = 1; 289 $SRCNODE->{transport}{remote_greeting}{global} = 1;
294 g_global_connect $SRCNODE->{id}; 290 g_global_connect $SRCNODE->{id};
295}; 291};
296 292
297# send the local db to themaster - outselves - to prime our global_db 293# enable global mode
298snd $MASTER, g_set => \%LOCAL_DB; 294$GLOBAL = 1;
295
296# global nodes are their own masters - this
297# resends global requests and sets the local database.
298master_set $NODE;
299
299# now add us to the set of global nodes 300# now add us to the set of global nodes
300db_set "'g" => $NODE => undef; 301db_set "'g" => $NODE => undef;
301 302
302=back 303=back
303 304

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines