-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(relay): flush relayed connection once idle #3765
Conversation
As a relay, when forwarding data between relay-connection-source and -destination and vice versa, flush write side when read currently has no more data available.
use quickcheck::QuickCheck; | ||
use std::io::ErrorKind; | ||
use std::pin::Pin; | ||
use std::task::{Context, Poll}; | ||
use std::time::Duration; | ||
|
||
struct Connection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make confusing diff easier to read:
Connection
is only used inquickckeck
test, thus moved intoquickcheck
test.PendingConnection
is only used inmax_circuit_duration
test, thus moved intomax_circuit_duration
test.
|
||
#[test] | ||
fn forward_data_should_flush_on_pending_source() { | ||
struct NeverEndingSource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct NeverEndingSource { | |
struct NeverEndingStory { |
"Given that destination is wrapped with a `BufWrite`, the write doesn't (yet) make it to \ | ||
the destination. The source might have more data available, thus `forward_data` has not \ | ||
yet flushed.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Given that destination is wrapped with a `BufWrite`, the write doesn't (yet) make it to \ | |
the destination. The source might have more data available, thus `forward_data` has not \ | |
yet flushed.", | |
"Expect BufWriter to still have space and thus not forward the poll_write call", |
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
|
//CC @p-shahi for visibility for the universal connectivity project. |
Description
As a relay, when forwarding data between relay-connection-source and -destination and vice versa, flush write side when read currently has no more data available.
Notes & open questions
Credit goes to @MarcoPolo for discovering this!
Change checklist