Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

fix(transport): use pull.empty for closing #200

Closed
wants to merge 1 commit into from

Conversation

dignifiedquire
Copy link
Member

@@ -67,7 +68,7 @@ module.exports = function (swarm) {
log('dial canceled: %s', multiaddr.toString())
// clean up already done dials
if (conn) {
conn.close()
pull(pull.empty(), conn)
Copy link
Member

Choose a reason for hiding this comment

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

This is just a quick patch for tests, it won't close connections as the otherside will be waiting for the multistream handshake to finish.

Copy link
Member

Choose a reason for hiding this comment

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

What I'm thinking now is:

Connections should have a conn.close that sends a pull.empty() by default or call their parent instance version of conn.close. Transports should overload that method to do a destroy/close, whatever the transport prefers.

When a stream muxer is applied, we need to make sure that conn.close gets overloaded back to the conn.close that defaults to pull.empty, because closing a muxed stream should not destroy the socket not the muxer.

This is similar to what we do with getPeerInfo

@dignifiedquire
Copy link
Member Author

sounds like a lot of work but the right approach 👍

@daviddias
Copy link
Member

I'm down to get this started with #202 and finish it in parallel, right now swarm is in this weird state where it can't be released from master because of conn.close, but it also solves the bug of several types of multiaddr.

This is work that users need and also our work in relay. So we have have a 'quick fix' of the pull.empty for now and work on what I proposed above: #200 (comment)

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