lib/router.js
/*
 * routes a message to a process by rank, and stores messsages to local
 * processes if they haven't been craeted yet
 * @param to {Number}: the recepient's rank
 * @param msg {Object}: the message to route
 */
routes a message to a process by rank, and stores messsages to local
processes if they haven't been craeted yet
@param to {Number}: the recepient's rank
@param msg {Object}: the message to route
routes a message to a process by rank and stores messsages to local processes if they haven ' t been craeted yet @param to { Number } : the recepient ' s rank @param msg { Object } : the message to route
function routeTo(to, msg) {
    if(meta_routing_table['proc' + to] === 'local') {
        if(!!locals_routiung_channels['proc' + to]) {
            try {
                locals_routiung_channels['proc' + to].send(msg);
            }
            catch(err) {
            }
        }
        else {
            if(!!waiting_queues['proc' + to]) {
                waiting_queues['proc' + to] = [];
            }
            waiting_queues['proc' + to].push(msg);
        }
    }
    else {
        var id = meta_routing_table['proc' + to];
        if(!!remote_routing_channels['sock_' + id]) {
            remote_routing_channels['sock_' + id].emit('KLYNG:MSG', msg);
        }
        else {
            if(!!waiting_queues['sock_' + id]) {
                waiting_queues['sock_' + id] = [];
            }
            waiting_queues['sock_' + id].push(msg);
        }
    }
}
function routeTo ( to , msg ) { if ( meta_routing_table [ 'proc' + to ] === 'local' ) { if ( ! ! locals_routiung_channels [ 'proc' + to ] ) { try { locals_routiung_channels [ 'proc' + to ] . send ( msg ) ; } catch ( err ) { } } else { if ( ! ! waiting_queues [ 'proc' + to ] ) { waiting_queues [ 'proc' + to ] = [ ] ; } waiting_queues [ 'proc' + to ] . push ( msg ) ; } } else { var id = meta_routing_table [ 'proc' + to ] ; if ( ! ! remote_routing_channels [ 'sock_' + id ] ) { remote_routing_channels [ 'sock_' + id ] . emit ( 'KLYNG:MSG' , msg ) ; } else { if ( ! ! waiting_queues [ 'sock_' + id ] ) { waiting_queues [ 'sock_' + id ] = [ ] ; } waiting_queues [ 'sock_' + id ] . push ( msg ) ; } } }
routes a message to a process by rank, and stores messsages to local
 processes if they haven't been craeted yet
 @param to {Number}: the recepient's rank
 @param msg {Object}: the message to route
routes a message to a process by rank and stores messsages to local processes if they haven ' t been craeted yet @param to { Number } : the recepient ' s rank @param msg { Object } : the message to route
// swallow the error to prevent the beacon from failing // NOTE: This is a lousy quick fix, think of something better