modules/reporting.js
function (onDone) {

	// store what to do after connected
	// NOTE: may be called repeatedly (if initial attempts fail or disconnect happens)
	if (typeof onDone === 'function')
		l_onConnect = onDone;

	if (l_ip_port === undefined) {
		LOG.warn('not init (or already disposed), cannot connect to server');
		return;
	}

	if (l_connector === undefined)    
		l_connector = new SR.Connector(l_config);

    // establish connection
	LOG.warn('connecting to: ', l_name);
	LOG.warn(l_ip_port, l_name);
	l_connector.connect(l_ip_port, function (err, socket) {
		
		if (err) {
			// try-again later
			LOG.warn('connect failed, try to re-connect in: ' + l_timeoutConnectRetry + 'ms', l_name);
			setTimeout(l_connect, l_timeoutConnectRetry);
			return;
		}

		LOG.warn('connection to: ' + socket.host + ':' + socket.port + ' established', l_name);
				
		UTIL.safeCall(l_onConnect);
	});    
}
function (onDone) {

	// store what to do after connected
	// NOTE: may be called repeatedly (if initial attempts fail or disconnect happens)
	if (typeof onDone === 'function')
		l_onConnect = onDone;

	if (l_ip_port === undefined) {
		LOG.warn('not init (or already disposed), cannot connect to server');
		return;
	}

	if (l_connector === undefined)    
		l_connector = new SR.Connector(l_config);

    // establish connection
	LOG.warn('connecting to: ', l_name);
	LOG.warn(l_ip_port, l_name);
	l_connector.connect(l_ip_port, function (err, socket) {
		
		if (err) {
			// try-again later
			LOG.warn('connect failed, try to re-connect in: ' + l_timeoutConnectRetry + 'ms', l_name);
			setTimeout(l_connect, l_timeoutConnectRetry);
			return;
		}

		LOG.warn('connection to: ' + socket.host + ':' + socket.port + ' established', l_name);
				
		UTIL.safeCall(l_onConnect);
	});    
}
function ( onDone ) { // store what to do after connected // NOTE: may be called repeatedly (if initial attempts fail or disconnect happens) if ( typeof onDone === 'function' ) l_onConnect = onDone ; if ( l_ip_port === undefined ) { LOG . warn ( 'not init (or already disposed), cannot connect to server' ) ; return ; } if ( l_connector === undefined ) l_connector = new SR . Connector ( l_config ) ; // establish connection LOG . warn ( 'connecting to: ' , l_name ) ; LOG . warn ( l_ip_port , l_name ) ; l_connector . connect ( l_ip_port , function ( err , socket ) { if ( err ) { // try-again later LOG . warn ( 'connect failed, try to re-connect in: ' + l_timeoutConnectRetry + 'ms' , l_name ) ; setTimeout ( l_connect , l_timeoutConnectRetry ) ; return ; } LOG . warn ( 'connection to: ' + socket . host + ':' + socket . port + ' established' , l_name ) ; UTIL . safeCall ( l_onConnect ) ; } ) ; }
connect to remote server
connect to remote server