Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
remove static keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed May 18, 2022
1 parent 4199e0e commit f043c3d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/connection/poll_data_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum ReadFut {
/// Nothing in progress.
Idle,
/// Reading data from the underlying stream.
Reading(Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'static>>),
Reading(Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send>>),
/// Finished reading, but there's unread data in the temporary buffer.
RemainingData(Vec<u8>),
}
Expand All @@ -52,7 +52,7 @@ impl ReadFut {
/// Panics if `ReadFut` variant is not `Reading`.
fn get_reading_mut(
&mut self,
) -> &mut Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'static>> {
) -> &mut Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send>> {
match self {
ReadFut::Reading(ref mut fut) => fut,
_ => panic!("expected ReadFut to be Reading"),
Expand Down Expand Up @@ -234,10 +234,14 @@ impl AsyncWrite for PollDataChannel<'_> {
}

fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
let dc = self.data_channel.clone();
let fut = self
.shutdown_fut
.get_or_insert_with(|| Box::pin(async move { dc.close().await }));
let fut = match self.shutdown_fut.as_mut() {
Some(fut) => fut,
None => {
let data_channel = self.data_channel.clone();
self.shutdown_fut
.get_or_insert(Box::pin(async move { data_channel.close().await }))
},
};

match ready!(fut.as_mut().poll(cx)) {
Err(e) => Poll::Ready(Err(webrtc_error_to_io(e))),
Expand Down

0 comments on commit f043c3d

Please sign in to comment.