Helper: Implements IO timeout wrappers #466
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In
workspace:project-pin-liteinto workspace dependencies. This will later replaceproject-pin.In
cuprate-p2p-core:send_timeoutfield to TcpInBoundStreamIn
cuprate-helper:WriteTimeoutandReadTimeoutwrapper ofAsyncWriteandAsyncReadrespectively.StreamTimeoutwrapper forAsyncWrite + AsyncReadtypes.ExtractDurationtrait for more flexibility on computing the timeout duration.What & Why
Discussed during monero-project/meta#1188
Is a mitigation against https://hackerone.com/reports/2912194
Complement #423
Keep-alive or spamming connections are a denial of service attack vector. This PR implements
AsyncRead/AsyncWritetimeout wrappers that will returnTimedOutif an operation do not succeed after a timeoutDuration.ReadTimeoutandWriteTimeoutare wrappingAsyncReadandAsyncWriterespectively.StreamTimeoutis wrappingAsyncRead + AsyncWrite.Question
Usage for P2P:
This is primarily meant to be used within the RPC server, but can also be integrated into p2p transport definition for an upper bound security. To discuss in meeting.