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

Made sctp PollStream Send + Sync #538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions sctp/src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ enum ReadFut {
/// Nothing in progress.
Idle,
/// Reading data from the underlying stream.
Reading(Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send>>),
Reading(Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + Sync>>),
/// Finished reading, but there's unread data in the temporary buffer.
RemainingData(Vec<u8>),
}
Expand All @@ -536,7 +536,9 @@ enum ShutdownFut {
/// Nothing in progress.
Idle,
/// Reading data from the underlying stream.
ShuttingDown(Pin<Box<dyn Future<Output = std::result::Result<(), crate::error::Error>>>>),
ShuttingDown(
Pin<Box<dyn Future<Output = std::result::Result<(), crate::error::Error>> + Send + Sync>>,
),
/// Shutdown future has run
Done,
Errored(crate::error::Error),
Expand All @@ -548,7 +550,9 @@ impl ReadFut {
/// # Panics
///
/// Panics if `ReadFut` variant is not `Reading`.
fn get_reading_mut(&mut self) -> &mut Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send>> {
fn get_reading_mut(
&mut self,
) -> &mut Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + Sync>> {
match self {
ReadFut::Reading(ref mut fut) => fut,
_ => panic!("expected ReadFut to be Reading"),
Expand All @@ -564,7 +568,9 @@ impl ShutdownFut {
/// Panics if `ShutdownFut` variant is not `ShuttingDown`.
fn get_shutting_down_mut(
&mut self,
) -> &mut Pin<Box<dyn Future<Output = std::result::Result<(), crate::error::Error>>>> {
) -> &mut Pin<
Box<dyn Future<Output = std::result::Result<(), crate::error::Error>> + Send + Sync>,
> {
match self {
ShutdownFut::ShuttingDown(ref mut fut) => fut,
_ => panic!("expected ShutdownFut to be ShuttingDown"),
Expand All @@ -581,7 +587,7 @@ pub struct PollStream {
stream: Arc<Stream>,

read_fut: ReadFut,
write_fut: Option<Pin<Box<dyn Future<Output = Result<usize>>>>>,
write_fut: Option<Pin<Box<dyn Future<Output = Result<usize>> + Send + Sync>>>,
shutdown_fut: ShutdownFut,

read_buf_cap: usize,
Expand Down