//Incoming internal Http2Stream(HeadersList headers, int id, WriteQueue writeQueue, FlowControlManager flowCrtlManager, ICompressionProcessor comprProc, Priority priority = Priority.Pri3) : this(id, writeQueue, flowCrtlManager, comprProc, priority) { Headers = headers; }
//Incoming internal Http2Stream(List<Tuple<string, string, IAdditionalHeaderInfo>> headers, int id, WriteQueue writeQueue, FlowControlManager flowCrtlManager, ICompressionProcessor comprProc, Priority priority = Priority.Pri3) : this(id, writeQueue, flowCrtlManager, comprProc, priority) { Headers = headers; }
public Http2Session(SecureSocket sessionSocket, ConnectionEnd end, bool usePriorities, bool useFlowControl, IDictionary<string, object> handshakeResult = null) { _ourEnd = end; _usePriorities = usePriorities; _useFlowControl = useFlowControl; _handshakeHeaders = new Dictionary<string, string>(16); ApplyHandshakeResults(handshakeResult); if (_ourEnd == ConnectionEnd.Client) { _remoteEnd = ConnectionEnd.Server; _lastId = -1; // Streams opened by client are odd } else { _remoteEnd = ConnectionEnd.Client; _lastId = 0; // Streams opened by server are even } _goAwayReceived = false; _settingsManager = new SettingsManager(); _comprProc = new CompressionProcessor(); _sessionSocket = sessionSocket; _frameReader = new FrameReader(_sessionSocket); ActiveStreams = new ActiveStreams(); _writeQueue = new WriteQueue(_sessionSocket, ActiveStreams, _usePriorities); OurMaxConcurrentStreams = 100; //Spec recommends value 100 by default RemoteMaxConcurrentStreams = 100; _flowControlManager = new FlowControlManager(this); if (!_useFlowControl) { _flowControlManager.Options = (byte) FlowControlOptions.DontUseFlowControl; } SessionWindowSize = 0; }
//Outgoing internal Http2Stream(int id, WriteQueue writeQueue, FlowControlManager flowCrtlManager, ICompressionProcessor comprProc, Priority priority = Priority.Pri3) { _id = id; Priority = priority; _writeQueue = writeQueue; _compressionProc = comprProc; _flowCrtlManager = flowCrtlManager; _unshippedFrames = new Queue<DataFrame>(16); SentDataAmount = 0; ReceivedDataAmount = 0; IsFlowControlBlocked = false; IsFlowControlEnabled = _flowCrtlManager.IsStreamsFlowControlledEnabled; WindowSize = _flowCrtlManager.StreamsInitialWindowSize; _flowCrtlManager.NewStreamOpenedHandler(this); }
public void ProcessSettings(SettingsFrame settingsFrame, Http2Session session, FlowControlManager flCtrlManager) { for (int i = 0; i < settingsFrame.EntryCount; i++) { switch (settingsFrame[i].Id) { case SettingsIds.MaxCurrentStreams: session.RemoteMaxConcurrentStreams = settingsFrame[i].Value; break; case SettingsIds.InitialWindowSize: flCtrlManager.StreamsInitialWindowSize = settingsFrame[i].Value; break; case SettingsIds.FlowControlOptions: flCtrlManager.Options = settingsFrame[i].Value; break; } } }