Add initial_max_send_streams() as builder option (#242)
This commit is contained in:
committed by
Carl Lerche
parent
0cb3e648e9
commit
4595b54cfa
@@ -46,6 +46,7 @@ where
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct Config {
|
||||
pub next_stream_id: StreamId,
|
||||
pub initial_max_send_streams: usize,
|
||||
pub reset_stream_duration: Duration,
|
||||
pub reset_stream_max: usize,
|
||||
pub settings: frame::Settings,
|
||||
@@ -80,7 +81,7 @@ where
|
||||
local_init_window_sz: config.settings
|
||||
.initial_window_size()
|
||||
.unwrap_or(DEFAULT_INITIAL_WINDOW_SIZE),
|
||||
local_max_initiated: None,
|
||||
initial_max_send_streams: config.initial_max_send_streams,
|
||||
local_next_stream_id: config.next_stream_id,
|
||||
local_push_enabled: config.settings.is_push_enabled(),
|
||||
local_reset_duration: config.reset_stream_duration,
|
||||
|
||||
@@ -32,7 +32,7 @@ impl Counts {
|
||||
pub fn new(peer: peer::Dyn, config: &Config) -> Self {
|
||||
Counts {
|
||||
peer,
|
||||
max_send_streams: config.local_max_initiated.unwrap_or(usize::MAX),
|
||||
max_send_streams: config.initial_max_send_streams,
|
||||
num_send_streams: 0,
|
||||
max_recv_streams: config.remote_max_initiated.unwrap_or(usize::MAX),
|
||||
num_recv_streams: 0,
|
||||
|
||||
@@ -26,17 +26,20 @@ use self::stream::Stream;
|
||||
use frame::{StreamId, StreamIdOverflow};
|
||||
use proto::*;
|
||||
|
||||
use std::time::Duration;
|
||||
use bytes::Bytes;
|
||||
use http::{Request, Response};
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Config {
|
||||
/// Initial window size of locally initiated streams
|
||||
pub local_init_window_sz: WindowSize,
|
||||
|
||||
/// Maximum number of locally initiated streams
|
||||
pub local_max_initiated: Option<usize>,
|
||||
/// Initial maximum number of locally initiated streams.
|
||||
/// After receiving a Settings frame from the remote peer,
|
||||
/// the connection will overwrite this value with the
|
||||
/// MAX_CONCURRENT_STREAMS specified in the frame.
|
||||
pub initial_max_send_streams: usize,
|
||||
|
||||
/// The stream ID to start the next local stream with
|
||||
pub local_next_stream_id: StreamId,
|
||||
|
||||
Reference in New Issue
Block a user