public void Add(Http2Stream item)
        {
            if (item.IsFlowControlEnabled)
            {
                FlowControlledStreams.Add(item.Id, item);
                return;
            }

            NonFlowControlledStreams.Add(item.Id, item);
        }
Exemple #2
0
        /// <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));
        }
Exemple #3
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.
 }
Exemple #4
0
        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);
        }
Exemple #5
0
        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
            {
            }
        }
Exemple #7
0
 public bool ContainsKey(int id)
 {
     return(NonFlowControlledStreams.ContainsKey(id) || FlowControlledStreams.ContainsKey(id));
 }
Exemple #8
0
 public void Clear()
 {
     FlowControlledStreams.Clear();
     NonFlowControlledStreams.Clear();
 }