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

Handle edge cases introduced with deferred payload piping #226

merged 2 commits into from Aug 20, 2018


Copy link

ggoodman commented Aug 10, 2018

  • If an error was emitted on the payload stream before the socket is connected, this could cause an uncaught exception
  • If a socket is re-used (for example from a keep-alive Agent), it may already be connected and therefore not emit connect. This only waits for the connect event if the socket is in the .connecting state.
@ggoodman ggoodman force-pushed the ggoodman:fix-already-connected-socket branch from e43e377 to b1caa90 Aug 20, 2018
stream.removeListener('error', onStreamError);

This comment has been minimized.

Copy link

ggoodman Aug 20, 2018

Author Contributor

Not sure if I meant to move this. Should this go before the piping?

@geek geek self-assigned this Aug 20, 2018
@geek geek added this to the 14.0.3 milestone Aug 20, 2018
@geek geek added the bug label Aug 20, 2018
@geek geek merged commit 3ac1eb4 into hapijs:master Aug 20, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@@ -332,19 +332,23 @@ internals.deferPipeUntilSocketConnects = function (req, stream) {

const onSocket = (socket) => {

if (!socket.connecting) {

This comment has been minimized.

Copy link

hueniverse Aug 21, 2018


No empty line here...

This comment has been minimized.

Copy link

geek Aug 21, 2018


I'll fix this up. I'm reviewing and testing before the publish

@ggoodman ggoodman deleted the ggoodman:fix-already-connected-socket branch Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.