public void Add(Http2Stream item) { if (item.IsFlowControlEnabled) { FlowControlledStreams.Add(item.Id, item); return; } NonFlowControlledStreams.Add(item.Id, item); }
/// <summary> /// Gets the streams opened by the specified endpoint. /// </summary> /// <param name="end">The endpoint.</param> /// <returns></returns> public int GetOpenedStreamsBy(ConnectionEnd end) { if (end == ConnectionEnd.Client) { return(FlowControlledStreams.Count(element => element.Key % 2 != 0) + NonFlowControlledStreams.Count(element => element.Key % 2 != 0)); } return(FlowControlledStreams.Count(element => element.Key % 2 == 0) + NonFlowControlledStreams.Count(element => element.Key % 2 == 0)); }
public bool Remove(int itemId) { if (FlowControlledStreams.ContainsKey(itemId)) { return(FlowControlledStreams.Remove(itemId)); } if (NonFlowControlledStreams.ContainsKey(itemId)) { return(NonFlowControlledStreams.Remove(itemId)); } return(true); //Nothing to delete. Item was already deleted. }
public bool TryGetValue(int key, out Http2Stream value) { if (FlowControlledStreams.TryGetValue(key, out value)) { return(true); } if (NonFlowControlledStreams.TryGetValue(key, out value)) { return(true); } return(false); }
public void Add(Http2Stream item) { if (ContainsKey(item.Id)) { throw new ArgumentException("This key already exists in the collection"); } if (item.IsFlowControlEnabled) { FlowControlledStreams.Add(item.Id, item); return; } NonFlowControlledStreams.Add(item.Id, item); }
public Http2Stream this[int key] { get { if (FlowControlledStreams.ContainsKey(key)) { return(FlowControlledStreams[key]); } if (NonFlowControlledStreams.ContainsKey(key)) { return(NonFlowControlledStreams[key]); } return(null); } set { } }
public bool ContainsKey(int id) { return(NonFlowControlledStreams.ContainsKey(id) || FlowControlledStreams.ContainsKey(id)); }
public void Clear() { FlowControlledStreams.Clear(); NonFlowControlledStreams.Clear(); }