fn read_substream(
        &self,
        cx: &mut Context<'_>,
        substream: &mut Self::Substream,
        buf: &mut [u8],
    ) -> Poll<Result<usize, Self::Error>> {
        let mut inner = self.inner.lock();

        match inner.connection.read_substream(*substream, buf) {
            Ok(bytes) => Poll::Ready(Ok(bytes)),
            Err(quinn_proto::ReadError::Reset(_)) => Poll::Ready(Ok(0)), // EOF
            Err(quinn_proto::ReadError::Blocked) => {
                if let Some(substream) = inner.substreams.get_mut(substream) {
                    if !substream
                        .read_waker
                        .as_ref()
                        .map_or(false, |w| w.will_wake(cx.waker()))
                    {
                        substream.read_waker = Some(cx.waker().clone());
                    }
                }
                Poll::Pending
            }
            Err(quinn_proto::ReadError::UnknownStream) => {
                log::error!(
                    "The application used a connection that is already being \
                    closed. This is a bug in the application or in libp2p."
                );
                Poll::Pending
            }
        }
    }
/// Try to read from a substream. This will return an error if the substream has
/// not yet been written to.
Try to read from a substream. This will return an error if the substream has
not yet been written to.
Try to read from a substream . This will return an error if the substream has not yet been written to .
fn read_substream(
        &self,
        cx: &mut Context<'_>,
        substream: &mut Self::Substream,
        buf: &mut [u8],
    ) -> Poll<Result<usize, Self::Error>> {
        let mut inner = self.inner.lock();
        match inner.connection.read_substream(*substream, buf) {
            Ok(bytes) => Poll::Ready(Ok(bytes)),
            Err(quinn_proto::ReadError::Reset(_)) => Poll::Ready(Ok(0)), // EOF
            Err(quinn_proto::ReadError::Blocked) => {
                if let Some(substream) = inner.substreams.get_mut(substream) {
                    if !substream
                        .read_waker
                        .as_ref()
                        .map_or(false, |w| w.will_wake(cx.waker()))
                    {
                        substream.read_waker = Some(cx.waker().clone());
                    }
                }
                Poll::Pending
            }
            Err(quinn_proto::ReadError::UnknownStream) => {
                log::error!(
                    "The application used a connection that is already being \
                    closed. This is a bug in the application or in libp2p."
                );
                Poll::Pending
            }
        }
    }
fn read_substream ( & self , cx : & mut Context < ' _ > , substream : & mut Self :: Substream , buf : & mut [ u8 ] , ) -> Poll < Result < usize , Self :: Error > > { let mut inner = self . inner . lock ( ) ; match inner . connection . read_substream ( * substream , buf ) { Ok ( bytes ) => Poll :: Ready ( Ok ( bytes ) ) , Err ( quinn_proto :: ReadError :: Reset ( _ ) ) => Poll :: Ready ( Ok ( 0 ) ) , // EOF Err ( quinn_proto :: ReadError :: Blocked ) => { if let Some ( substream ) = inner . substreams . get_mut ( substream ) { if ! substream . read_waker . as_ref ( ) . map_or ( false , | w | w . will_wake ( cx . waker ( ) ) ) { substream . read_waker = Some ( cx . waker ( ) . clone ( ) ) ; } } Poll :: Pending } Err ( quinn_proto :: ReadError :: UnknownStream ) => { log :: error ! ( " \
 " ) ; Poll :: Pending } } }
Try to read from a substream.
Try to read from a substream .
&self
cx
&mut Context<'_>
substream
&mut Self::Substream
buf
&mut [u8]
&self
cx
&mut Context<'_>
substream
&mut Self::Substream
buf
&mut [u8]