示例#1
0
        public override AChannel GetChannel(long id)
        {
            UChannel channel = null;

            this.idChannels.TryGetValue(id, out channel);
            return(channel);
        }
示例#2
0
        public override AChannel ConnectChannel(string host, int port)
        {
            USocket  newSocket = new USocket(this.poller);
            UChannel channel   = new UChannel(newSocket, host, port, this);

            this.idChannels[channel.Id] = channel;
            return(channel);
        }
示例#3
0
        public override AChannel ConnectChannel(IPEndPoint ipEndPoint)
        {
            USocket  newSocket = new USocket(this.poller);
            UChannel channel   = new UChannel(newSocket, ipEndPoint, this);

            this.idChannels[channel.Id] = channel;
            return(channel);
        }
示例#4
0
        public override async Task <AChannel> AcceptChannel()
        {
            USocket socket = await this.poller.AcceptAsync();

            UChannel channel = new UChannel(socket, this);

            this.idChannels[channel.Id] = channel;
            return(channel);
        }
示例#5
0
        public override void Dispose()
        {
            if (this.poller == null)
            {
                return;
            }

            foreach (long id in this.idChannels.Keys.ToArray())
            {
                UChannel channel = this.idChannels[id];
                channel.Dispose();
            }

            this.poller = null;
        }