-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
There was a problem hiding this 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.
Blocked on fixing an issue with multistream. |
9691336
to
dd87884
Compare
7a7d3a5
to
b33cbc7
Compare
There was a problem hiding this 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/net/mock/mock_stream.go
Outdated
} | ||
|
||
func (s *stream) Close() error { | ||
s.CloseRead() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
func (s *stream) resetWith(err error) { | ||
func (s *stream) cancelWrite(err error) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c34fc5a
to
fd6ec7d
Compare
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`.
fd6ec7d
to
7a98f28
Compare
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 likenet.TCPConn.Close
.Stream.CloseWrite
(send an EOF) andStream.CloseRead
(close for reading), behaving like their counterparts innet.TCPConn
.Dependencies:
Bubbling: