1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +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) {
this.append(buffer);
var type;
while (true) {
var offset = this._offset;
try {
@@ -137,20 +137,33 @@ FasterReplyParser.prototype.execute = function (buffer) {
break;
}
var type = this._buffer[this._offset++];
type = this._buffer[this._offset++];
if (type === 43) { // +
ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(ret);
} else if (type === 45) { // -
ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_error(ret);
} else if (type === 58) { // :
ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(+ret);
} else if (type === 36) { // $
ret = this._parseResult(type);
if (ret === null) {
break;
}
this.send_reply(ret);
} else if (type === 42) { // *
// set a rewind point. if a failure occurs,
@@ -167,8 +180,8 @@ FasterReplyParser.prototype.execute = function (buffer) {
} catch(err) {
// catch the error (not enough data), rewind, and wait
// for the next packet to appear
this._offset = offset;
break;
this._offset = offset;
break;
}
}
};
@@ -207,6 +220,7 @@ FasterReplyParser.prototype.append = function(newBuffer) {
this._buffer = tmpBuffer;
}
this._offset = 0;
};
@@ -245,7 +259,7 @@ FasterReplyParser.prototype.parser_error = function (message) {
FasterReplyParser.prototype.send_error = function (reply) {
this.emit("reply error", reply);
};
var count = 0;
FasterReplyParser.prototype.send_reply = function (reply) {
this.emit("reply", reply);
};