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

            this.idChannels.TryGetValue(id, out channel);
            return(channel);
        }
示例#2
0
        public async Task <AChannel> GetChannel()
        {
            USocket socket = await this.poller.AcceptAsync();

            UChannel channel = new UChannel(socket, this);

            this.channels[channel.RemoteAddress] = channel;
            this.idChannels[channel.Id]          = channel;
            return(channel);
        }
示例#3
0
        public void Remove(AChannel channel)
        {
            UChannel tChannel = channel as UChannel;

            if (tChannel == null)
            {
                return;
            }
            this.idChannels.Remove(channel.Id);
            this.channels.Remove(channel.RemoteAddress);
        }
示例#4
0
        public AChannel GetChannel(string host, int port)
        {
            UChannel channel = null;

            if (this.channels.TryGetValue(host + ":" + port, out channel))
            {
                return(channel);
            }

            USocket newSocket = new USocket(this.poller);

            channel = new UChannel(newSocket, host, port, this);
            this.channels[channel.RemoteAddress] = channel;
            this.idChannels[channel.Id]          = channel;
            this.SocketConnectAsync(channel);
            return(channel);
        }
示例#5
0
        private void Dispose(bool disposing)
        {
            if (this.poller == null)
            {
                return;
            }

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

            this.poller = null;
        }
示例#6
0
		public AChannel GetChannel(string host, int port)
		{
			UChannel channel = null;
			if (this.channels.TryGetValue(host + ":" + port, out channel))
			{
				return channel;
			}

			USocket newSocket = new USocket(this.poller);
			channel = new UChannel(newSocket, host, port, this);
			this.channels[channel.RemoteAddress] = channel;
			this.idChannels[channel.Id] = channel;
			this.SocketConnectAsync(channel);
			return channel;
		}
示例#7
0
		public async Task<AChannel> GetChannel()
		{
			USocket socket = await this.poller.AcceptAsync();
			UChannel channel = new UChannel(socket, this);
			this.channels[channel.RemoteAddress] = channel;
			this.idChannels[channel.Id] = channel;
			return channel;
		}