You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we just terminate the stream when receiving a message, and do not send a Disconnect message when disconnecting. The EthStream treats the underlying stream it wraps as a generic Stream and Sink, so we will need to add an additional bound that is implemented as a no-op by standard stream types like TcpStream.
Something like the following:
/// This trait is meant to allow higher level protocols like `eth` to disconnect from a peer, using/// lower-level disconnect functions (such as those that exist in the `p2p` protocol) if the/// underlying stream supports it.#[async_trait::async_trait]pubtraitCanDisconnect<T>:Sink<T> + Unpin + Sized{/// Disconnects from the underlying stream, using a [`DisconnectReason`] as disconnect/// information if the stream implements a protocol that can carry the additional disconnect/// metadata.asyncfndisconnect(&mutself,reason:DisconnectReason,) -> Result<(), <SelfasSink<T>>::Error>;}
This will then be implemented by P2PStream, so an EthStream<P2PStream<S>> can access this method on its inner field.
Describe the feature
Currently we just terminate the stream when receiving a message, and do not send a
Disconnect
message when disconnecting. TheEthStream
treats the underlying stream it wraps as a genericStream
andSink
, so we will need to add an additional bound that is implemented as a no-op by standard stream types likeTcpStream
.Something like the following:
This will then be implemented by
P2PStream
, so anEthStream<P2PStream<S>>
can access this method on itsinner
field.Additional context
Hive
devp2p
tests depend on this functionality, and reth currently fails due to this:https://github.com/paradigmxyz/reth/actions/runs/4237113733/jobs/7362781160#step:7:34
This is where hive checks for a disconnect in the
devp2p
tests:https://github.com/ethereum/go-ethereum/blob/fe01a2f63b8591d8226742726d8d6aaad4cd981e/cmd/devp2p/internal/ethtest/helpers.go#L511
The text was updated successfully, but these errors were encountered: