generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Problem: Currently, when a peer deliberately closes a connection (indicated by SCTP_USER_INITIATED_ABORT with cause code 12), we detect it but still trigger automatic reconnection. This wastes resources and ignores the peer's intent to close the connection.
Expected Behavior:
- Detect intentional disconnects (
SCTP_USER_INITIATED_ABORT/ cause code 12) - Do not automatically reconnect when the disconnect was intentional
- Provide an explicit mechanism for closing connections (e.g.,
closeConnection(peerId)) - Track which peers have intentionally disconnected and require explicit reconnection
Implementation:
- Modify
readChannelinnetwork.tsto distinguish intentional disconnects from failures - Add state tracking for intentionally closed connections
- Prevent
handleConnectionLossfrom starting reconnection for intentional disconnects - Add API for explicit connection closure (possibly in
RemoteManagerorinitNetworkreturn)
Acceptance Criteria:
- Intentional disconnects are detected and logged appropriately
- No automatic reconnection occurs after intentional disconnect
- Explicit close mechanism is available and tested
- Reconnection can be manually triggered after intentional close if needed
Metadata
Metadata
Assignees
Labels
No labels