Add initial_max_send_streams() as builder option (#242)

This commit is contained in:
Darren Tsung
2018-03-16 11:58:06 -07:00
committed by Carl Lerche
parent 0cb3e648e9
commit 4595b54cfa
5 changed files with 62 additions and 5 deletions

View File

@@ -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,

View File

@@ -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,