Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

fix: transport should not handle connection if upgradeInbound throws #16

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch 2 times, most recently from 2760411 to b4e0163 Compare December 20, 2019 10:36
@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch from b4e0163 to 7bb5448 Compare December 20, 2019 10:50
await listener.listen(addrs[0])

// Create a connection to the listener
const socket = await transport.dial(addrs[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

@vasco-santos I think we should validate the socket was closed as well. Since the listener throws, it should hangup, so the dial socket should get closed. We could wait for timeline.close to exist after the dial before closing everything. await pWaitFor(() => typeof socket.timeline.close === 'number') or something similar.

Other than that, this looks good. I mainly just want to ensure we are properly closing the sockets on inbound errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think that is better

@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch from 48135da to 215282a Compare December 20, 2019 15:41
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@jacobheun jacobheun merged commit ff03137 into master Dec 20, 2019
@jacobheun jacobheun deleted the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch December 20, 2019 16:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants