Repository navigation
tokio-boring: record when the stream was first read - #548
Conversation
|
This pull request's reviews are posted as pull request reviews: see the review of |
|
@clanky-the-clanker review |
There was a problem hiding this comment.
Superseded by the review of
ca2f16ad.
This review, of dfd53534
💬 Approved with comments — The implementation and the test are correct. The only comment is an optional clarification to the doc comment.
Findings: 1 info (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📝 Documentation: 💬 1 info
The doc comment slightly overstates what the timestamp measures
Recommendation: 💬 Optional Nits
- [INFO] The doc comment says the timestamp is when the hello 'started arriving'. It is actually when the first read returned bytes. (
tokio-boring/src/lib.rs:164)
View full review
tokio-boring/src/lib.rs:164describes the timestamp as when the peer's hello "started arriving". The code recordsInstant::now()when the first read returns bytes, which can be later than when the bytes actually arrived.
✅ All other checks passed
📋 Code Quality: ✅ LGTM
first_readis set only when a read actually returns bytes.WouldBlock, errors and EOF don't set it.- The bridge is the same object during the handshake and on the established stream, so the timestamp carries over once the handshake completes.
- The test takes its start time before the server is polled, and the client sleeps only after it has connected, so the assertion that the first read came at least the delay after the start is sound.
Reviewed commit: dfd53534
1a53cf8 to
ca2f16a
Compare
|
clanky review |
There was a problem hiding this comment.
⚠️ Out of date: this review is ofca2f16ad; the pull request is now atd7dfb5c9. Someone with write access can commentclanky review(orclanker reviewor@clanky-the-clanker review) to review the new commits.
💬 Approved with comments — The implementation, the switch to tokio's Instant, and the test are correct. The only comment is an optional doc clarification for streams built with from_raw_parts.
Findings: 1 info (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📝 Documentation: 💬 1 info
One optional clarification for streams created with from_raw_parts.
Recommendation: 💬 Optional Nits
- [INFO] The ClientHello/ServerHello wording only holds when tokio-boring performs the handshake itself, not for streams created with
from_raw_parts. (tokio-boring/src/lib.rs:164)
View full review
tokio-boring/src/lib.rs:164-165says the first read is the peer's ClientHello or ServerHello.from_raw_partsbuilds a new bridge, withfirst_read: None, around a handshake that may have finished elsewhere. For such a stream,first_read_at()reflects a later application-data read.
✅ All other checks passed
📋 Code Quality: ✅ LGTM
tokio::time::Instantneeds tokio'stimefeature, andtokio-boring/Cargo.tomlnow enables it.first_readis set only when a read returns more than 0 bytes.WouldBlock, errors and EOF don't set it.- The same bridge object is used during the handshake and on the established stream, so the timestamp carries over to
SslStream::first_read_at. - The test takes its start time before the server is polled, and the client sleeps only after it has connected. So the assertion that the first read came at least
DELAYafter the start is sound.
Reviewed commit: ca2f16ad
Add SslStream::first_read_at, which returns when a read from the underlying stream first returned data. Servers can use it to time the TLS handshake from the start of the ClientHello rather than from TCP accept, so time spent waiting for the peer is not counted.
ca2f16a to
d7dfb5c
Compare
Add SslStream::first_read_at, which returns when bytes were first read from the underlying stream. Servers can use it to time the TLS handshake from the start of the ClientHello rather than from TCP accept, so time spent waiting for the peer is not counted.