Skip to content

Commit a089620

Browse files
committed
Fixed the decoder error when reading half length of buffer.
1 parent c14a786 commit a089620

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes Logs
22

3+
## v0.1.2
4+
5+
- Fixed the decoder error when reading half length of buffer.
6+
37
## v0.1.1
48

59
- Achieved the listen mode for subscriber.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@litert/redis",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "A redis protocol implement for Node.js.",
55
"main": "./dist/index.js",
66
"scripts": {

sources/lib/Decoder.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ implements Core.Decoder {
152152
default:
153153
this.emit("error", new Exception(
154154
Constants.INVALID_FORMAT,
155-
"Unrecognizable format of stream."
155+
"Unrecognizable format of stream.",
156+
this._cursor + "/" + JSON.stringify(this._buf.toString())
156157
));
157158
return this;
158159
}
@@ -176,7 +177,7 @@ implements Core.Decoder {
176177
}
177178
else {
178179

179-
this._cursor = this._buf.length - 2;
180+
// this._cursor = this._buf.length - 2;
180181
return this;
181182
}
182183

@@ -199,7 +200,7 @@ implements Core.Decoder {
199200
}
200201
else {
201202

202-
this._cursor = this._buf.length - 2;
203+
// this._cursor = this._buf.length - 2;
203204
return this;
204205
}
205206

@@ -222,7 +223,7 @@ implements Core.Decoder {
222223
}
223224
else {
224225

225-
this._cursor = this._buf.length - 2;
226+
// this._cursor = this._buf.length - 2;
226227
return this;
227228
}
228229

@@ -256,7 +257,7 @@ implements Core.Decoder {
256257
}
257258
else {
258259

259-
this._cursor = this._buf.length - 2;
260+
// this._cursor = this._buf.length - 2;
260261
return this;
261262
}
262263

@@ -290,7 +291,7 @@ implements Core.Decoder {
290291
}
291292
else {
292293

293-
this._cursor = this._buf.length - 2;
294+
// this._cursor = this._buf.length - 2;
294295
return this;
295296
}
296297

@@ -309,7 +310,7 @@ implements Core.Decoder {
309310
}
310311
else {
311312

312-
this._cursor = this._buf.length - 2;
313+
// this._cursor = this._buf.length - 2;
313314
return this;
314315
}
315316

0 commit comments

Comments
 (0)