fn handle_new_stream(
        &mut self,
        conn: &mut Connection,
        stream_type: NewStreamType,
        stream_id: StreamId,
    ) -> Res<ReceiveOutput> {
        match stream_type {
            NewStreamType::Control => {
                self.check_stream_exists(Http3StreamType::Control)?;
                self.recv_streams
                    .insert(stream_id, Box::new(ControlStreamRemote::new(stream_id)));
            }

            NewStreamType::Push(push_id) => {
                qinfo!(
                    [self],
                    "A new push stream {} push_id:{}.",
                    stream_id,
                    push_id
                );
            }
            NewStreamType::Decoder => {
                qinfo!([self], "A new remote qpack encoder stream {}", stream_id);
                self.check_stream_exists(Http3StreamType::Decoder)?;
                self.recv_streams.insert(
                    stream_id,
                    Box::new(DecoderRecvStream::new(
                        stream_id,
                        Rc::clone(&self.qpack_decoder),
                    )),
                );
            }
            NewStreamType::Encoder => {
                qinfo!([self], "A new remote qpack decoder stream {}", stream_id);
                self.check_stream_exists(Http3StreamType::Encoder)?;
                self.recv_streams.insert(
                    stream_id,
                    Box::new(EncoderRecvStream::new(
                        stream_id,
                        Rc::clone(&self.qpack_encoder),
                    )),
                );
            }
            NewStreamType::Http => {
                qinfo!([self], "A new http stream {}.", stream_id);
            }
            NewStreamType::WebTransportStream(session_id) => {
                let session_exists = self
                    .send_streams
                    .get(&StreamId::from(session_id))
                    .map_or(false, |s| {
                        s.stream_type() == Http3StreamType::ExtendedConnect
                    });
                if !session_exists {
                    conn.stream_stop_sending(stream_id, Error::HttpStreamCreation.code())?;
                    return Ok(ReceiveOutput::NoOutput);
                }
            }
            NewStreamType::Unknown => {
                conn.stream_stop_sending(stream_id, Error::HttpStreamCreation.code())?;
            }
        };

        match stream_type {
            NewStreamType::Control | NewStreamType::Decoder | NewStreamType::Encoder => {
                self.stream_receive(conn, stream_id)
            }
            NewStreamType::Push(_) | NewStreamType::Http | NewStreamType::WebTransportStream(_) => {
                Ok(ReceiveOutput::NewStream(stream_type))
            }
            NewStreamType::Unknown => Ok(ReceiveOutput::NoOutput),
        }
    }
/// If the new stream is a control stream, this function creates a proper handler
/// and perform a read.
/// if the new stream is a push stream, the function returns `ReceiveOutput::PushStream`
/// and the caller will handle it.
/// If the stream is of a unknown type the stream will be closed.
If the new stream is a control stream, this function creates a proper handler
and perform a read.
if the new stream is a push stream, the function returns `ReceiveOutput::PushStream`
and the caller will handle it.
If the stream is of a unknown type the stream will be closed.
If the new stream is a control stream this function creates a proper handler and perform a read . if the new stream is a push stream the function returns ` ReceiveOutput :: PushStream ` and the caller will handle it . If the stream is of a unknown type the stream will be closed .
fn handle_new_stream(
        &mut self,
        conn: &mut Connection,
        stream_type: NewStreamType,
        stream_id: StreamId,
    ) -> Res<ReceiveOutput> {
        match stream_type {
            NewStreamType::Control => {
                self.check_stream_exists(Http3StreamType::Control)?;
                self.recv_streams
                    .insert(stream_id, Box::new(ControlStreamRemote::new(stream_id)));
            }
            NewStreamType::Push(push_id) => {
                qinfo!(
                    [self],
                    "A new push stream {} push_id:{}.",
                    stream_id,
                    push_id
                );
            }
            NewStreamType::Decoder => {
                qinfo!([self], "A new remote qpack encoder stream {}", stream_id);
                self.check_stream_exists(Http3StreamType::Decoder)?;
                self.recv_streams.insert(
                    stream_id,
                    Box::new(DecoderRecvStream::new(
                        stream_id,
                        Rc::clone(&self.qpack_decoder),
                    )),
                );
            }
            NewStreamType::Encoder => {
                qinfo!([self], "A new remote qpack decoder stream {}", stream_id);
                self.check_stream_exists(Http3StreamType::Encoder)?;
                self.recv_streams.insert(
                    stream_id,
                    Box::new(EncoderRecvStream::new(
                        stream_id,
                        Rc::clone(&self.qpack_encoder),
                    )),
                );
            }
            NewStreamType::Http => {
                qinfo!([self], "A new http stream {}.", stream_id);
            }
            NewStreamType::WebTransportStream(session_id) => {
                let session_exists = self
                    .send_streams
                    .get(&StreamId::from(session_id))
                    .map_or(false, |s| {
                        s.stream_type() == Http3StreamType::ExtendedConnect
                    });
                if !session_exists {
                    conn.stream_stop_sending(stream_id, Error::HttpStreamCreation.code())?;
                    return Ok(ReceiveOutput::NoOutput);
                }
            }
            NewStreamType::Unknown => {
                conn.stream_stop_sending(stream_id, Error::HttpStreamCreation.code())?;
            }
        };
        match stream_type {
            NewStreamType::Control | NewStreamType::Decoder | NewStreamType::Encoder => {
                self.stream_receive(conn, stream_id)
            }
            NewStreamType::Push(_) | NewStreamType::Http | NewStreamType::WebTransportStream(_) => {
                Ok(ReceiveOutput::NewStream(stream_type))
            }
            NewStreamType::Unknown => Ok(ReceiveOutput::NoOutput),
        }
    }
fn handle_new_stream ( & mut self , conn : & mut Connection , stream_type : NewStreamType , stream_id : StreamId , ) -> Res < ReceiveOutput > { match stream_type { NewStreamType :: Control => { self . check_stream_exists ( Http3StreamType :: Control ) ? ; self . recv_streams . insert ( stream_id , Box :: new ( ControlStreamRemote :: new ( stream_id ) ) ) ; } NewStreamType :: Push ( push_id ) => { qinfo ! ( [ self ] " " stream_id push_id ) ; } NewStreamType :: Decoder => { qinfo ! ( [ self ] " " stream_id ) ; self . check_stream_exists ( Http3StreamType :: Decoder ) ? ; self . recv_streams . insert ( stream_id , Box :: new ( DecoderRecvStream :: new ( stream_id , Rc :: clone ( & self . qpack_decoder ) , ) ) , ) ; } NewStreamType :: Encoder => { qinfo ! ( [ self ] " " stream_id ) ; self . check_stream_exists ( Http3StreamType :: Encoder ) ? ; self . recv_streams . insert ( stream_id , Box :: new ( EncoderRecvStream :: new ( stream_id , Rc :: clone ( & self . qpack_encoder ) , ) ) , ) ; } NewStreamType :: Http => { qinfo ! ( [ self ] " " stream_id ) ; } NewStreamType :: WebTransportStream ( session_id ) => { let session_exists = self . send_streams . get ( & StreamId :: from ( session_id ) ) . map_or ( false , | s | { s . stream_type ( ) == Http3StreamType :: ExtendedConnect } ) ; if ! session_exists { conn . stream_stop_sending ( stream_id , Error :: HttpStreamCreation . code ( ) ) ? ; return Ok ( ReceiveOutput :: NoOutput ) ; } } NewStreamType :: Unknown => { conn . stream_stop_sending ( stream_id , Error :: HttpStreamCreation . code ( ) ) ? ; } } ; match stream_type { NewStreamType :: Control | NewStreamType :: Decoder | NewStreamType :: Encoder => { self . stream_receive ( conn , stream_id ) } NewStreamType :: Push ( _ ) | NewStreamType :: Http | NewStreamType :: WebTransportStream ( _ ) => { Ok ( ReceiveOutput :: NewStream ( stream_type ) ) } NewStreamType :: Unknown => Ok ( ReceiveOutput :: NoOutput ) , } }
If the new stream is a control stream, this function creates a proper handler
and perform a read.
If the new stream is a control stream this function creates a proper handler and perform a read .
&mut self
conn
&mut Connection
stream_type
NewStreamType
stream_id
StreamId