-
Notifications
You must be signed in to change notification settings - Fork 244
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 #70 #120
base: master
Are you sure you want to change the base?
fix for #70 #120
Conversation
sock.resume(); | ||
cb(undefined, source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the original problem with this order was that 'data' events would start emitting immediately when calling .resume()
. So I moved the .resume()
after to allow the callback to set up 'data' events so as not to miss them. However that was probably from the node v0.8-ish days where streams weren't quite as good as they are nowadays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d actually find it handy to have the stream paused by default and let consumers resume it when they are ready, this is kind of cosmetic but I think many users can be confused by the current behaviour. The other change (moving return within the if block) is not cosmetic, in my case, it made the lib completely unusable, there was no way I would receive the end event without it and that broke piping.
Did
On 03 Jun 2015, at 16:47, Brian White [email protected] wrote:
In lib/connection.js #120 (comment):
sock.resume();
I believe the original problem with this order was that 'data' events would start emitting immediately when calling .resume(). So I moved the .resume() after to allow the callback to set up 'data' events so as not to miss them. However that was probably from the node v0.8-ish days where streams weren't quite as good as they are nowadays.cb(undefined, source);
—
Reply to this email directly or view it on GitHub https://github.com/mscdex/node-ftp/pull/120/files#r31630219.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it makes sense to leave it paused nowadays, but in node v0.8 and earlier, it would have been unexpected. Perhaps making these changes, bumping the required node version, and releasing a new major would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that makes sense, for now we can still merge this one and change the
default to paused for the next release?
Did
On Wed, Jun 3, 2015 at 5:23 PM, Brian White [email protected]
wrote:
In lib/connection.js
#120 (comment):sock.resume();
cb(undefined, source);
Right, it makes sense to leave it paused nowadays, but in node v0.8 and
earlier, it would have been unexpected. Perhaps making these changes,
bumping the required node version, and release a new major would be best.—
Reply to this email directly or view it on GitHub
https://github.com/mscdex/node-ftp/pull/120/files#r31634833.
Is this PR waiting on something to be merged? I would be more than happy to fix it if I knew what was holding it up. |
} | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change actually necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, definitely, without it, when end is reached the last bytes are never emitted because return is called before we emit them!!
@dcolens @phillipgreenii I've removed the |
The reason for the move of the return is in the commit description: "- send end event when data is consumed after a get“, i.e. with the return outside the if, the ‘end’ event does not fire after a get. Did
|
You should really fully merge this |
#70