Inheritance: AChannel
Exemple #1
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;
		}
Exemple #2
0
        public override AChannel GetChannel(long id)
        {
            UChannel channel = null;

            this.idChannels.TryGetValue(id, out channel);
            return(channel);
        }
Exemple #3
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;
		}
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
0
        public override AChannel GetChannel(string host, int port)
        {
            UChannel channel = null;

            USocket newSocket = new USocket(this.poller);

            channel = new UChannel(newSocket, host, port, this);
            newSocket.Disconnect       += () => this.OnChannelError(channel.Id, SocketError.SocketError);
            this.idChannels[channel.Id] = channel;
            return(channel);
        }
Exemple #7
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;
        }
Exemple #8
0
        private void Dispose(bool disposing)
        {
            if (this.poller == null)
            {
                return;
            }

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

            this.poller = null;
        }