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

feat: update to go-libp2p-core 0.7.0 interface changes #1001

Merged
merged 1 commit into from
Nov 11, 2020

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Sep 2, 2020

This patch updates go-libp2p for the stream interface changes in go-libp2p-core 0.7.0. This is a significant breaking change to streams and all users should read https://github.com/libp2p/go-libp2p-core/releases/tag/v0.7.0. In practice, this change should remove a significant footgun.

TL;DR:

  • Stream.Close now behaves like net.TCPConn.Close.
  • There is a new Stream.CloseWrite (send an EOF) and Stream.CloseRead (close for reading), behaving like their counterparts in net.TCPConn.

Dependencies:

Bubbling:

@Stebalien Stebalien requested a review from vyzo September 2, 2020 22:19
Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

changes are nice and simple and LGTM, but let's hold a bit to figure out our upgrade path for pubsub/dht/lotus/ipfs etc.

@Stebalien Stebalien added the status/blocked Unable to be worked further until needs are met label Sep 3, 2020
@Stebalien
Copy link
Member Author

Blocked on fixing an issue with multistream.

@Stebalien Stebalien force-pushed the feat/rw-stream branch 2 times, most recently from 7a7d3a5 to b33cbc7 Compare November 2, 2020 19:29
@Stebalien Stebalien removed the status/blocked Unable to be worked further until needs are met label Nov 2, 2020
Stebalien added a commit to libp2p/go-libp2p-gostream that referenced this pull request Nov 2, 2020
Stebalien added a commit to ipfs/go-graphsync that referenced this pull request Nov 2, 2020
Stebalien added a commit to ipfs/go-graphsync that referenced this pull request Nov 2, 2020
Stebalien added a commit to libp2p/go-libp2p-gostream that referenced this pull request Nov 2, 2020
Copy link
Collaborator

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

In ping.go, should PingHandler and Ping be utilizing Closes instead of Resets now?

Otherwise LGTM

p2p/host/basic/basic_host.go Show resolved Hide resolved
p2p/net/mock/mock_net.go Show resolved Hide resolved
}

func (s *stream) Close() error {
s.CloseRead()
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need _ = to satisfy the linter?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have that linter here, but it can't hurt.

@@ -26,7 +25,7 @@ func (ids *IDService) deltaHandler(s network.Stream) {
return
}

defer helpers.FullClose(s)
defer s.Close()
Copy link
Collaborator

Choose a reason for hiding this comment

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

what qualifies as requiring a reset? e.g. does failing to consume the delta warrant a reset?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Although the other end likely isn't listening for an error.

Comment on lines -283 to +292
func (s *stream) resetWith(err error) {
func (s *stream) cancelWrite(err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any test changes downstream that would be effected by this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe I needed this to fix an issue in the bitswap tests.

This patch updates go-libp2p for the stream interface changes in go-libp2p-core
0.7.0. This is a _significant_ breaking change to streams and all users should
read https://github.com/libp2p/go-libp2p-core/releases/tag/v0.7.0. In practice,
this change should remove a significant footgun.

TL;DR:

* `Stream.Close` now behaves like `net.TCPConn.Close`.
* There is a new `Stream.CloseWrite` (send an EOF) and `Stream.CloseRead` (close
  for reading), behaving like their counterparts in `net.TCPConn`.
@Stebalien Stebalien merged commit fcf6964 into master Nov 11, 2020
@Stebalien Stebalien deleted the feat/rw-stream branch November 11, 2020 17:42
Stebalien added a commit to libp2p/go-libp2p-gostream that referenced this pull request Nov 12, 2020
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
marten-seemann pushed a commit that referenced this pull request Aug 29, 2023
gts2030 pushed a commit to superblock-dev/go-libp2p that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants