Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset compressor/decompressor instead of re-initialize #1840

Merged
merged 2 commits into from Feb 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 8 additions & 10 deletions lib/permessage-deflate.js
Expand Up @@ -376,12 +376,11 @@ class PerMessageDeflate {
this._inflate[kTotalLength]
);

this._inflate[kTotalLength] = 0;
this._inflate[kBuffers] = [];

if (fin && this.params[`${endpoint}_no_context_takeover`]) {
this._inflate.close();
this._inflate = null;
} else {
this._inflate[kTotalLength] = 0;
this._inflate[kBuffers] = [];
this._inflate.reset();
}

callback(null, data);
Expand Down Expand Up @@ -448,12 +447,11 @@ class PerMessageDeflate {
//
this._deflate[kCallback] = null;

this._deflate[kTotalLength] = 0;
this._deflate[kBuffers] = [];

if (fin && this.params[`${endpoint}_no_context_takeover`]) {
this._deflate.close();
this._deflate = null;
} else {
this._deflate[kTotalLength] = 0;
this._deflate[kBuffers] = [];
this._deflate.reset();
}

callback(null, data);
Expand Down