From 041d992bc5b94e10292788849b1ae23ae1b14ef1 Mon Sep 17 00:00:00 2001 From: V Sreekanth Date: Mon, 22 Apr 2013 20:06:43 +0530 Subject: [PATCH] Unpiping the response for ultimate magic --- config/config.json | 2 +- lib/redis_command.js | 4 ++-- server.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/config.json b/config/config.json index d788950..95e0074 100644 --- a/config/config.json +++ b/config/config.json @@ -1,7 +1,7 @@ { "servers": [{ "host": "localhost" - ,"port": 6399 + ,"port": 6379 } , { "host": "localhost" diff --git a/lib/redis_command.js b/lib/redis_command.js index 4cf3fa2..93279ea 100644 --- a/lib/redis_command.js +++ b/lib/redis_command.js @@ -10,9 +10,9 @@ var connectionCommands = ['auth', 'select']; module.exports = redisCommand = { readOnly: function(command){ - return _.include(readOnlyCommands, command.split("\r\n")[2].toLowerCase()); + return _.include(readOnlyCommands, command.split("\r\n")[2]); } , connection: function(command){ - return _.include(connectionCommands, command.split("\r\n")[2].toLowerCase()); + return _.include(connectionCommands, command.split("\r\n")[2]); } }; \ No newline at end of file diff --git a/server.js b/server.js index 174e998..ad69bbd 100644 --- a/server.js +++ b/server.js @@ -15,7 +15,8 @@ var bindAddress = config.bind_address || "127.0.0.1", var server = net.createServer(function (socket) { - logger.debug('client connected'); + var id = socket.remoteAddress+':'+socket.remotePort + logger.debug('client connected ' + id); socket.on('end', function() { logger.info('client disconnected'); // Hack to get the connection identifier, so that we can release the connection @@ -28,8 +29,7 @@ var server = net.createServer(function (socket) { socket.on('data', function(data) { var command = data.toString('utf8'), id = socket.remoteAddress+':'+socket.remotePort; redis_proxy.sendCommand(command, id, function(err, response) { - response.removeAllListeners(); - logger.debug('got response'); + if( response) response.unpipe(); if(err){ return socket.write("-ERR Error Happened "+ err); }