1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

fix all but lrange 20k

This commit is contained in:
Jerry Sievert
2012-08-22 21:53:18 -07:00
parent 34568a4bb3
commit 8be55fb304

View File

@@ -126,7 +126,7 @@ FasterReplyParser.prototype._parseResult = function (type) {
FasterReplyParser.prototype.execute = function (buffer) { FasterReplyParser.prototype.execute = function (buffer) {
this.append(buffer); this.append(buffer);
var type;
while (true) { while (true) {
var offset = this._offset; var offset = this._offset;
try { try {
@@ -137,20 +137,33 @@ FasterReplyParser.prototype.execute = function (buffer) {
break; break;
} }
var type = this._buffer[this._offset++]; type = this._buffer[this._offset++];
if (type === 43) { // + if (type === 43) { // +
ret = this._parseResult(type); ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(ret); this.send_reply(ret);
} else if (type === 45) { // - } else if (type === 45) { // -
ret = this._parseResult(type); ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_error(ret); this.send_error(ret);
} else if (type === 58) { // : } else if (type === 58) { // :
ret = this._parseResult(type); ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(+ret); this.send_reply(+ret);
} else if (type === 36) { // $ } else if (type === 36) { // $
ret = this._parseResult(type); ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(ret); this.send_reply(ret);
} else if (type === 42) { // * } else if (type === 42) { // *
// set a rewind point. if a failure occurs, // set a rewind point. if a failure occurs,
@@ -207,6 +220,7 @@ FasterReplyParser.prototype.append = function(newBuffer) {
this._buffer = tmpBuffer; this._buffer = tmpBuffer;
} }
this._offset = 0; this._offset = 0;
}; };
@@ -245,7 +259,7 @@ FasterReplyParser.prototype.parser_error = function (message) {
FasterReplyParser.prototype.send_error = function (reply) { FasterReplyParser.prototype.send_error = function (reply) {
this.emit("reply error", reply); this.emit("reply error", reply);
}; };
var count = 0;
FasterReplyParser.prototype.send_reply = function (reply) { FasterReplyParser.prototype.send_reply = function (reply) {
this.emit("reply", reply); this.emit("reply", reply);
}; };