Skip to content

Commit

Permalink
disable client bundle handling if bundle becomes too big
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat authored Dec 27, 2023
1 parent 92964c9 commit 2eb5ba5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Client extends EventEmitter {
const s = JSON.stringify(parsed.data, null, 2)
debug(s && s.length > 10000 ? parsed.data : s)
}
if (parsed.metadata.name === 'bundle_delimiter') {
if (this._hasBundlePacket && parsed.metadata.name === 'bundle_delimiter') {
if (this._mcBundle.length) { // End bundle
this._mcBundle.forEach(emitPacket)
emitPacket(parsed)
Expand All @@ -103,6 +103,12 @@ class Client extends EventEmitter {
}
} else if (this._mcBundle.length) {
this._mcBundle.push(parsed)
if (this._mcBundle.length > 32) {
this._mcBundle.forEach(emitPacket)
emitPacket(parsed)
this._mcBundle = []
this._hasBundlePacket = false
}
} else {
emitPacket(parsed)
}
Expand Down

0 comments on commit 2eb5ba5

Please sign in to comment.