Skip to content

Commit

Permalink
Update serializer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat authored Dec 22, 2024
1 parent b8614e1 commit ea497b9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ class Parser extends Transform {
try {
packet = this.parsePacketBuffer(this.queue)
} catch (e) {
e.buffer = this.queue
if (e.partialReadError) { return cb() } else {
if (e.partialReadError) {
e.buffer = this.queue
return cb(e)
} else {
this.queue = Buffer.alloc(0)
return cb(e)
}
Expand Down Expand Up @@ -78,14 +80,7 @@ class FullPacketParser extends Transform {
}
} catch (e) {
e.buffer = this.queue
if (e.partialReadError) {
if (!this.noErrorLogging) {
console.log(e.stack)
}
return cb()
} else {
return cb(e)
}
return cb(e)
}
this.push(packet)
cb()
Expand Down

0 comments on commit ea497b9

Please sign in to comment.