Fixed some bugs with internal share processing

This commit is contained in:
Matt 2014-03-05 15:31:32 -07:00
parent 5c19ec9abc
commit d2f9be48d2
3 changed files with 16 additions and 6 deletions

View File

@ -90,7 +90,7 @@ module.exports = function(logger){
var authString = authorized ? 'Authorized' : 'Unauthorized '; var authString = authorized ? 'Authorized' : 'Unauthorized ';
poolLogger.debug('client', authorized + ' [' + ip + '] ' + workerName + ':' + password); poolLogger.debug('client', authString + ' [' + ip + '] ' + workerName + ':' + password);
callback({ callback({
error: null, error: null,
authorized: authorized, authorized: authorized,

View File

@ -8,13 +8,23 @@ module.exports = function(logger, poolConfig){
var connection; var connection;
function connect(){ function connect(){
var connection = connections[coin] = redis.createClient(redisConfig.port, redisConfig.host);
var reconnectTimeout;
var connection = redis.createClient(redisConfig.port, redisConfig.host);
connection.on('ready', function(){
clearTimeout(reconnectTimeout);
logger.debug('redis', 'Successfully connected to redis database');
});
connection.on('error', function(err){ connection.on('error', function(err){
logger.error('redis', 'Redis client had an error: ' + JSON.stringify(err)) logger.error('redis', 'Redis client had an error: ' + JSON.stringify(err))
}); });
connection.on('end', function(){ connection.on('end', function(){
logger.warning('redis', 'Connection to redis database as been ended'); logger.error('redis', 'Connection to redis database as been ended');
connect(); logger.warning('redis', 'Trying reconnection in 3 seconds...');
reconnectTimeout = setTimeout(function(){
connect();
}, 3000);
}); });
} }
connect(); connect();

View File

@ -22,7 +22,7 @@
"shareProcessing": { "shareProcessing": {
"internal": { "internal": {
"enabled": false, "enabled": true,
"daemon": { "daemon": {
"host": "localhost", "host": "localhost",
"port": 19332, "port": 19332,
@ -35,7 +35,7 @@
} }
}, },
"mpos": { "mpos": {
"enabled": true, "enabled": false,
"host": "localhost", "host": "localhost",
"port": 3306, "port": 3306,
"user": "me", "user": "me",