| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
CI: https://ci.nodejs.org/job/node-test-commit/15999/ |
Sorry, something went wrong.
There was a problem hiding this comment.
SGTM
Sorry, something went wrong.
There was a problem hiding this comment.
I wonder if this if statement can be removed. readable is automatically set to false when 'end' is emitted and maybeDestroy() is called by the handler below.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, but end hasn’t necessarily been emitted here. But you’re right, the handler below was supposed to be in the else block for this.
Sorry, something went wrong.
There was a problem hiding this comment.
Yes but if I'm not wrong 'end' will not be emitted on the same tick, so why aren't we only relying on the 'end' event? Is it to avoid attaching a listener?
Sorry, something went wrong.
There was a problem hiding this comment.
Is it to avoid attaching a listener?
Yes, I assume that’s it. Maybe it isn’t that important?
Sorry, something went wrong.
There was a problem hiding this comment.
I don't know, I don't think it will make a big difference but there is also no real advantage in removing the "fast case" so let's keep it as is :)
Sorry, something went wrong.
There was a problem hiding this comment.
FWIW we are now emitting '_socketEnd' and attaching the listener all the time as 'end' is not emitted on the same tick.
I also think this branch can create a race where 'close' can be emitted before 'end' as _handle.close() is called before the 'end' event is emitted if maybeDestroy() succeeds.
TL;DR I think it's better to always rely on the 'end' event.
Sorry, something went wrong.
There was a problem hiding this comment.
TL;DR I think it's better to always rely on the 'end' event.
I am cool with that if we can agree that the fast-pathing is not worth it … I like the simplicity :)
Updated!
Sorry, something went wrong.
There was a problem hiding this comment.
Can we remove this event ('_socketEnd') or is it kept to avoid possible breakage?
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Gotcha.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with CI and CITGM green
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry to pester but this should be no longer needed now. readableLength is 0 so 'end' will be emitted on the next tick and it will already set readable to false.
It's also possible that the 'end' event will never be emitted, for example if onread() returns an error before reaching this point, so I wonder if it's better to only add the 'end' listener here instead of the constructor.
Sorry, something went wrong.
There was a problem hiding this comment.
this should be no longer needed now
Hm, I could have sworn there were test failures when I tired that… anyway, it seems to pass now, so: Done!
It's also possible that the 'end' event will never be emitted, for example if onread() returns an error before reaching this point, so I wonder if it's better to only add the 'end' listener here instead of the constructor.
That’s not really the common case, is it? I don’t think I have a strong preference.
Sorry, something went wrong.
There was a problem hiding this comment.
Indeed it isn't, I'm perfectly fine with this as is. Thanks for bearing with me.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you please remove the commented code?
Sorry, something went wrong.
Sorry, something went wrong.
|
Rebased with a minor conflict |
Sorry, something went wrong.
PR-URL: nodejs#18607 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#18607 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label. |
Sorry, something went wrong.
PR-URL: nodejs#18607 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#18607 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
net