libp2p / go-libp2p-core

Interfaces and abstractions that make up go-libp2p
Other
145 stars 75 forks source link

remove OpenedStream and ClosedStream from Notifiee interface #250

Closed marten-seemann closed 2 years ago

marten-seemann commented 2 years ago

As far as I can tell, nobody is using the OpenedStream and ClosedStream notification.

This is because they're not really useful: You can get a notification that the swarm opened a new stream, but you can read, write, close or reset the stream without interfering with the application. Therefore you won't even know which libp2p protocol is being negotiated on that stream.

github-actions[bot] commented 2 years ago

gocompat says:

branch 'master' set up to track 'origin/master'.
"github.com/libp2p/go-libp2p-core/network".NotifyBundle.OpenedStreamF FieldDeleted
"github.com/libp2p/go-libp2p-core/network".NotifyBundle.ClosedStreamF FieldDeleted
"github.com/libp2p/go-libp2p-core/network".NotifyBundle.OpenedStream MethodDeleted
"github.com/libp2p/go-libp2p-core/network".NotifyBundle.ClosedStream MethodDeleted
"github.com/libp2p/go-libp2p-core/network".NoopNotifiee.OpenedStream MethodDeleted
"github.com/libp2p/go-libp2p-core/network".NoopNotifiee.ClosedStream MethodDeleted
"github.com/libp2p/go-libp2p-core/network".Notifiee InterfaceChanged
Stebalien commented 2 years ago

We ahve some tests inside bitswap, but that's it. It looks like elrond may have been using this for some form of connection management, but really the hook isn't all that useful.

I'd remove it and figure out a way to fix upstream.