-
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_service: Improve connection stability by downgrading connec…
…tions on substream inactivity (#260) This PR advances the keep-alive timeout of the transport service. Previously, the keep-alive timeout was triggered 5 seconds after the connection was reported to the transport service regardless of substream activity. - (0secs) T0: connection established; keep-alive timeout set to 5seconds in the future - (4secs) T1: substream A, B, C opened - (5secs) T2: keep-alive timeout triggered and the connection is downgraded. T1 was not taken into account, otherwise, the keep-alive timeout should be triggered at second 9 (T1 at 4 seconds + keepalive 5 seconds) - (6secs) T3: substreams A, B, C closed -> connection closes - (7secs) T4: cannot open new substreams even if we expected the connection to be kept alive for longer In this PR: - `KeepAliveTracker` structure to forward the keep-alive timeout of connections. - Connection ID is forwarded to `SubstreamOpened` events to identify properly substream Ids. This is needed because the `ConnectionContext` contains up to two connections (primary and secondary) ### Testing Done - test to ensure keepalive downgrades the connection after 5 seconds - test to ensure keepalive is forwarded on substream activity - test to ensure a downgraded connection with dropped substreams is closed Closes #253. --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Dmitry Markin <dmitry@markin.tech>
- Loading branch information
1 parent
c0fef8d
commit 314a2e9
Showing
9 changed files
with
790 additions
and
38 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
Oops, something went wrong.