Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Unpiping the response for ultimate magic

  • Loading branch information...
commit 041d992bc5b94e10292788849b1ae23ae1b14ef1 1 parent 406d65a
@sreeix authored
Showing with 6 additions and 6 deletions.
  1. +1 −1  config/config.json
  2. +2 −2 lib/redis_command.js
  3. +3 −3 server.js
View
2  config/config.json
@@ -1,7 +1,7 @@
{
"servers": [{
"host": "localhost"
- ,"port": 6399
+ ,"port": 6379
}
, {
"host": "localhost"
View
4 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]);
}
};
View
6 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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.