示例#1
0
        public bool Add(FABChannel channel)
        {
            ConcurrentDictionary <FABChannelId, FABChannel> map = channel is IServerChannel ? this.serverChannels : this.nonServerChannels;
            bool added = map.TryAdd(channel.Id, channel);

            if (added)
            {
                channel.CloseCompletion.ContinueWith(x => this.Remove(channel));
            }
            return(added);
        }
示例#2
0
        public bool Remove(FABChannel channel)
        {
            FABChannel ch;

            if (channel is IServerChannel)
            {
                return(this.serverChannels.TryRemove(channel.Id, out ch));
            }
            else
            {
                return(this.nonServerChannels.TryRemove(channel.Id, out ch));
            }
        }
示例#3
0
        public bool Contains(FABChannel item)
        {
            FABChannel channel;

            if (item is IServerChannel)
            {
                return(this.serverChannels.TryGetValue(item.Id, out channel) && channel == item);
            }
            else
            {
                return(this.nonServerChannels.TryGetValue(item.Id, out channel) && channel == item);
            }
        }