… | |
… | |
302 | } else { |
302 | } else { |
303 | g_disconnect $_[0]; |
303 | g_disconnect $_[0]; |
304 | } |
304 | } |
305 | }; |
305 | }; |
306 | |
306 | |
|
|
307 | # now, this is messy |
|
|
308 | AnyEvent::MP::Kernel::post_configure { |
307 | # enable global mode |
309 | # enable global mode |
308 | $GLOBAL = 1; |
310 | $GLOBAL = 1; |
309 | |
311 | |
310 | # global nodes are their own masters - this |
312 | # global nodes are their own masters - this |
311 | # resends global requests and sets the local database. |
313 | # resends global requests and sets the local database. |
312 | master_set $NODE; |
314 | master_set $NODE; |
313 | |
315 | |
314 | # now add us to the set of global nodes |
316 | # now add us to the set of global nodes |
315 | db_set "'g" => $NODE; |
317 | db_set "'g" => $NODE; |
316 | |
318 | |
317 | # tell other nodes that we are global now |
319 | # tell other nodes that we are global now |
318 | for (up_nodes) { |
320 | for (up_nodes) { |
319 | snd $_, "g_global"; |
321 | snd $_, "g_global"; |
320 | |
322 | |
321 | # if the node is global, connect |
323 | # if the node is global, connect |
322 | g_global_connect $_ |
324 | g_global_connect $_ |
323 | if exists $GLOBAL_NODE{$_}; |
325 | if exists $GLOBAL_NODE{$_}; |
324 | } |
326 | } |
325 | |
327 | |
326 | # from here on we should be able to act "normally" |
328 | # from here on we should be able to act "normally" |
327 | |
329 | |
328 | # maintain connections to all global nodes that we know of |
330 | # maintain connections to all global nodes that we know of |
329 | db_mon "'g" => sub { |
331 | db_mon "'g" => sub { |
330 | keepalive_add $_ for @{ $_[1] }; |
332 | keepalive_add $_ for @{ $_[1] }; |
331 | keepalive_del $_ for @{ $_[3] }; |
333 | keepalive_del $_ for @{ $_[3] }; |
|
|
334 | }; |
332 | }; |
335 | }; |
333 | |
336 | |
334 | ############################################################################# |
337 | ############################################################################# |
335 | # compatibility functions for aemp 1.0 |
338 | # compatibility functions for aemp 1.0 |
336 | |
339 | |