Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

WIP document Conn.Close #19

Merged
merged 3 commits into from
Sep 11, 2017

Conversation

marten-seemann
Copy link
Contributor

@marten-seemann marten-seemann changed the title document Conn.Close WIP document Conn.Close Sep 9, 2017
@marten-seemann
Copy link
Contributor Author

I just added a test for this, and it fails both for SPDY and for Yamux. They both close the underlying net.Conn, when Close is called.

I see two ways forward here:

  1. We change the SPDY and Yamux implementation to keep the net.Conn open. This shouldn't be a problem for Yamux, since that implementation is owned by @whyrusleeping, but we'd have to convince docker to change the SPDY implementation (or find some hack there).
  2. We change our definition of Close: Close means that the stream muxer is closed AND the underlying net.Conn is closed as well. Then we don't have to change the stream muxer implementations, and we could then get rid of one of the Close calls in do connection setup here go-libp2p-conn#9 (comment).

While 1. is the more general solution (in principle, you could use a single TCP connection to first speak some SPDY, then close SPDY and switch to Yamux), I don't think we'll gain a lot from that in practice. I'd therefore suggest option 2.
No matter how we decide, we should document the expected behavior (and test for it). I'll update this PR accordingly.

@whyrusleeping and @Stebalien, what do you think?

@Stebalien
Copy link
Member

I'd much prefer 2. The way I see it, you pass ownership of the connection to the stream muxer when you create it.

@marten-seemann
Copy link
Contributor Author

Glad you agree. I updated the documentation and the test case.
This should be ready to merge now.

@Stebalien Stebalien merged commit a0904d8 into libp2p:master Sep 11, 2017
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