Skip to content
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

Make SendRequest Sync #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gopakumarce
Copy link
Contributor

@gopakumarce gopakumarce commented Dec 12, 2023

SendRequest is clone-able and Send-able which is convenient for applications to store/embed SendRequest in their own structures and use that from different async tasks. This would also mean that if the application is sharing reference to their structures (that has a SendRequest inside) across tasks, then SendRequest would need to be Sync too. It will be really really convenient to have SendRequest as Sync or else the applications will basically have to wrap the SendRequest in Arc<Mutex<>>

SendRequest has the "open" element which implements OpenStreams, and these are basically Stream futures. Streams are not Sync, there is plenty of discussions on related topics in this link - https://internals.rust-lang.org/t/what-shall-sync-mean-across-an-await/1202

I am not exactly sure why the OpenStreams methods are implemented as futures that are stored in SendRequest, why cant they be implemented as open_foo() calls into the underlying quinn connection from the pollers in OpenStreams. I am assuming there is a good reason for that (which I am interested in learning), and hence if we want to retain these as stored futures, then basically I am doing a SyncWrap of those here

SendRequest is clone-able and Send-able which is convenient for
applications to store/embed SendRequest in their own structures
and use that from different async tasks. This would also mean that
if the application is sharing reference to their structures (that
has a SendRequest inside) across tasks, then SendRequest would
need to be Sync too. It will be really really convenient to have
SendRequest as Sync or else the applications will basically have
to wrap the SendRequest in Arc<Mutex<>>

SendRequest has the "open" element which implements OpenStreams,
and these are basically Stream futures. Streams are not Sync, there
is plenty of discussions on related topics in this link -
https://internals.rust-lang.org/t/what-shall-sync-mean-across-an-await/1202

I am not exactly sure why the OpenStreams methods are implemented
as futures that are stored in SendRequest, why cant they be implemented
as open_foo() calls into the underlying quinn connection from the pollers
in OpenStreams. I am assuming there is a good reason for that (which I
am interested in learning), and hence if we want to retain these are
stored futures, then basically I am doing a SyncWrap of those here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant