@@ -677,10 +677,11 @@ RedisClient.prototype.send_command = function (command, args, callback) {
677677 err = new Error ( 'send_command: ' + command + ' value must not be undefined or null' ) ;
678678 err . command = command ;
679679 if ( callback ) {
680- return callback && callback ( err ) ;
680+ callback ( err ) ;
681+ } else {
682+ this . emit ( 'error' , err ) ;
681683 }
682- this . emit ( 'error' , err ) ;
683- return ;
684+ return false ;
684685 }
685686 }
686687
@@ -715,7 +716,8 @@ RedisClient.prototype.send_command = function (command, args, callback) {
715716 this . offline_queue . push ( command_obj ) ;
716717 this . should_buffer = true ;
717718 }
718- return ;
719+ // Return false to signal no buffering
720+ return false ;
719721 }
720722
721723 if ( command === 'subscribe' || command === 'psubscribe' || command === 'unsubscribe' || command === 'punsubscribe' ) {
@@ -728,7 +730,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
728730 err = new Error ( 'Connection in subscriber mode, only subscriber commands may be used' ) ;
729731 err . command = command . toUpperCase ( ) ;
730732 this . emit ( 'error' , err ) ;
731- return ;
733+ return false ;
732734 }
733735 this . command_queue . push ( command_obj ) ;
734736 this . commands_sent += 1 ;
@@ -916,8 +918,7 @@ commands.forEach(function (fullCommand) {
916918// store db in this.select_db to restore it on reconnect
917919RedisClient . prototype . select = RedisClient . prototype . SELECT = function ( db , callback ) {
918920 var self = this ;
919-
920- this . send_command ( 'select' , [ db ] , function ( err , res ) {
921+ return this . send_command ( 'select' , [ db ] , function ( err , res ) {
921922 if ( err === null ) {
922923 self . selected_db = db ;
923924 }
@@ -939,16 +940,16 @@ RedisClient.prototype.auth = RedisClient.prototype.AUTH = function (pass, callba
939940 } else {
940941 this . emit ( 'error' , err ) ;
941942 }
942- return ;
943+ return false ;
943944 }
944945 this . auth_pass = pass ;
945946 debug ( 'Saving auth as ' + this . auth_pass ) ;
946947 // Only run the callback once. So do not safe it if already connected
947948 if ( this . connected ) {
948- this . send_command ( 'auth' , [ this . auth_pass ] , callback ) ;
949- } else {
950- this . auth_callback = callback ;
949+ return this . send_command ( 'auth' , [ this . auth_pass ] , callback ) ;
951950 }
951+ this . auth_callback = callback ;
952+ return false ;
952953} ;
953954
954955RedisClient . prototype . hmset = RedisClient . prototype . HMSET = function ( key , args , callback ) {
@@ -1048,7 +1049,7 @@ Multi.prototype.exec = Multi.prototype.EXEC = function (callback) {
10481049 this . send_command ( command , args , index , cb ) ;
10491050 }
10501051
1051- this . _client . send_command ( 'exec' , [ ] , function ( err , replies ) {
1052+ return this . _client . send_command ( 'exec' , [ ] , function ( err , replies ) {
10521053 self . execute_callback ( err , replies ) ;
10531054 } ) ;
10541055} ;
0 commit comments