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

Fix for http transport. Probably breaks TCP transport (not tested) #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/pkt-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function deframer(emit) {
var more = true;

return function (item) {

var doUndefined = false;
// Forward the EOS marker
if (item === undefined) return emit();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is probably called in the tcp transport, but never in the HTTP transport.


Expand Down Expand Up @@ -65,6 +65,7 @@ function deframer(emit) {
state = 0;
length = 0;
if (data[0] === 1) {
var doUndefined = true;
more = emit(bodec.slice(data, 1));
}
else if (data[0] === 2) {
Expand All @@ -90,7 +91,7 @@ function deframer(emit) {
throw new Error("pkt-line decoder in invalid state");
}
}

if (doUndefined) emit();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to emit undefined, but only after the http request that pulled in the delta's. the above two lines achieve this for a clean clone. I'm not sure this will also work for a fetch. I haven't read the documentation on the smart http protocol yet.

return more;
};

Expand Down