feat(swarm): close connections on multistream-select protocol violations#3482
feat(swarm): close connections on multistream-select protocol violations#3482thomaseizinger wants to merge 1 commit intomasterfrom
multistream-select protocol violations#3482Conversation
|
I am in favor of no longer forwarding errors to a |
Say a remote peer opens a stream, starts a multistream-select negotiation, but aborts half-way through and drops the stream, thus leading to an IO error on the stream on the side of the local node. Do I understand correctly that with this patch the whole connection would be closed? If so, I don't think that is a good behavior as a single failing stream does not imply that the whole connection is useless. |
True, we'd have to still report those back to the handler I guess. |
|
Closing this because we discovered unintended consequences (see discussion above). |
|
We are in agreement that the IO error should not close the connection.
We are not in agreement here. I don't think an IO error during protocol negotiation of an inbound stream needs to be reported to the handler. There isn't even a specific handler to deliver the error to, as we don't yet know the protocol as negotiating it failed in the first place. |
Fair, I forgot about that. Let me investigate what that leads to. |
|
I opened a new PR: #3605 |
Description
As per discussion in #3353, this patch proposes to not report what I deem to be fatal errors during protocol negotiation to a
ConnectionHandlerbut instead close the entire connection.The error is returned to the
Swarmas the reason for why the connection is being closed.Notes
I consider this a medium-risk PR because it introduces a potentially drastic change in behaviour. Previously, a
ConnectionHandlercould simply ignore these errors and a peer that only happened to f.e. send a bad protocol name for one stream but was otherwise well-behaved worked fine. With this patch, such a connection would get closed by theSwarm.Links to any relevant issues
Open Questions
ProtocolErrorand only "close" the connection on IO errors but still report protocol violations back to theConnectionHandler?Change checklist