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

            this.idChannels.TryGetValue(id, out channel);
            return(channel);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #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;
		}
Beispiel #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;
		}