Coverage Report

Created: 2026-05-30 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/h2/src/proto/streams/mod.rs
Line
Count
Source
1
mod buffer;
2
mod counts;
3
mod flow_control;
4
mod prioritize;
5
mod recv;
6
mod send;
7
mod state;
8
mod store;
9
mod stream;
10
#[allow(clippy::module_inception)]
11
mod streams;
12
13
pub(crate) use self::prioritize::Prioritized;
14
pub(crate) use self::recv::Open;
15
pub(crate) use self::send::PollReset;
16
pub(crate) use self::streams::{DynStreams, OpaqueStreamRef, StreamRef, Streams};
17
18
use self::buffer::Buffer;
19
use self::counts::Counts;
20
use self::flow_control::FlowControl;
21
use self::prioritize::Prioritize;
22
use self::recv::Recv;
23
use self::send::Send;
24
use self::state::State;
25
use self::store::Store;
26
use self::stream::Stream;
27
28
use crate::frame::{StreamId, StreamIdOverflow};
29
use crate::proto::*;
30
31
use bytes::Bytes;
32
use std::time::Duration;
33
34
#[derive(Debug)]
35
pub struct Config {
36
    /// Initial maximum number of locally initiated streams.
37
    /// After receiving a Settings frame from the remote peer,
38
    /// the connection will overwrite this value with the
39
    /// MAX_CONCURRENT_STREAMS specified in the frame.
40
    pub initial_max_send_streams: usize,
41
42
    /// Max amount of DATA bytes to buffer per stream.
43
    pub local_max_buffer_size: usize,
44
45
    /// The stream ID to start the next local stream with
46
    pub local_next_stream_id: StreamId,
47
48
    /// If the local peer is willing to receive push promises
49
    pub local_push_enabled: bool,
50
51
    /// If extended connect protocol is enabled.
52
    pub extended_connect_protocol_enabled: bool,
53
54
    /// How long a locally reset stream should ignore frames
55
    pub local_reset_duration: Duration,
56
57
    /// Maximum number of locally reset streams to keep at a time
58
    pub local_reset_max: usize,
59
60
    /// Maximum number of remotely reset "pending accept" streams to keep at a
61
    /// time. Going over this number results in a connection error.
62
    pub remote_reset_max: usize,
63
64
    /// Initial window size of remote initiated streams
65
    pub remote_init_window_sz: WindowSize,
66
67
    /// Maximum number of remote initiated streams
68
    pub remote_max_initiated: Option<usize>,
69
70
    /// Maximum number of locally reset streams due to protocol error across
71
    /// the lifetime of the connection.
72
    ///
73
    /// When this gets exceeded, we issue GOAWAYs.
74
    pub local_max_error_reset_streams: Option<usize>,
75
}
76
77
trait DebugStructExt<'a, 'b> {
78
    // h2_ prefixes to protect against possible future name collisions
79
    fn h2_field_if(&mut self, name: &str, val: &bool) -> &mut std::fmt::DebugStruct<'a, 'b>;
80
81
    fn h2_field_if_then<T: std::fmt::Debug>(
82
        &mut self,
83
        name: &str,
84
        cond: bool,
85
        val: &T,
86
    ) -> &mut std::fmt::DebugStruct<'a, 'b>;
87
88
    fn h2_field_some<T: std::fmt::Debug>(
89
        &mut self,
90
        name: &str,
91
        val: &Option<T>,
92
    ) -> &mut std::fmt::DebugStruct<'a, 'b>;
93
}
94
95
impl<'a, 'b> DebugStructExt<'a, 'b> for std::fmt::DebugStruct<'a, 'b> {
96
0
    fn h2_field_if(&mut self, name: &str, val: &bool) -> &mut std::fmt::DebugStruct<'a, 'b> {
97
0
        if *val {
98
0
            self.field(name, val)
99
        } else {
100
0
            self
101
        }
102
0
    }
103
104
0
    fn h2_field_if_then<T: std::fmt::Debug>(
105
0
        &mut self,
106
0
        name: &str,
107
0
        cond: bool,
108
0
        val: &T,
109
0
    ) -> &mut std::fmt::DebugStruct<'a, 'b> {
110
0
        if cond {
111
0
            self.field(name, val)
112
        } else {
113
0
            self
114
        }
115
0
    }
Unexecuted instantiation: <core::fmt::builders::DebugStruct as h2::proto::streams::DebugStructExt>::h2_field_if_then::<h2::proto::streams::store::Queue<h2::proto::streams::stream::NextAccept>>
Unexecuted instantiation: <core::fmt::builders::DebugStruct as h2::proto::streams::DebugStructExt>::h2_field_if_then::<h2::proto::streams::buffer::Deque>
116
117
0
    fn h2_field_some<T: std::fmt::Debug>(
118
0
        &mut self,
119
0
        name: &str,
120
0
        val: &Option<T>,
121
0
    ) -> &mut std::fmt::DebugStruct<'a, 'b> {
122
0
        if val.is_some() {
123
0
            self.field(name, val)
124
        } else {
125
0
            self
126
        }
127
0
    }
Unexecuted instantiation: <core::fmt::builders::DebugStruct as h2::proto::streams::DebugStructExt>::h2_field_some::<h2::proto::streams::store::Key>
Unexecuted instantiation: <core::fmt::builders::DebugStruct as h2::proto::streams::DebugStructExt>::h2_field_some::<std::time::Instant>
Unexecuted instantiation: <core::fmt::builders::DebugStruct as h2::proto::streams::DebugStructExt>::h2_field_some::<()>
128
}