-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transport: Add accept_pending/reject_pending for inbound connections …
…and introduce inbound limits (#194) This PR refactors the transport trait to allow the transport manager to decide if the incoming connection should be negotiated or rejected immediately. Before this PR, the transports (TCP, ws) eagerly accepted inbound connections and started negotiating. This consumed resources if the node was already at the limits or connected. To achieve this, each transport was refactored to pass the responsibility of accepting connections to the transport manager. After the refactor, we are able to look at the connection limits before accepting a new inbound connection. ### Notes This PR aims to introduce the methods and only looks at the connection limits. In the future (soonish), we need to tackle separately: - state machine refactoring to accept only 1 inbound connection per peer context - accept/reject inbounds after looking at peer context (ie if already connected there's no benefit) - s2n-quic transport is out of date and outside the scope of this PR ### Next Steps - Look at the performance impact of communicating between transport manager <-> individual transports - If the impact is significant (although under load I expect the channel communication of 2 messages to be faster than eagerly negotiating), then we can look into simplifying the events. However, this gives us a robust view of each transport, and allows us not to negotiate a connection if the peer is already connected. Closes: #186 Part of: #17 cc @paritytech/networking --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Dmitry Markin <[email protected]>
- Loading branch information
1 parent
3b664f7
commit 6ffcc85
Showing
9 changed files
with
442 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.