Inheritance: AChannel
コード例 #1
0
        public override AChannel GetChannel(long id)
        {
            TChannel channel = null;

            this.idChannels.TryGetValue(id, out channel);
            return(channel);
        }
コード例 #2
0
ファイル: TService.cs プロジェクト: egametang/Egametang
		public override AChannel ConnectChannel(string host, int port)
		{
			TSocket newSocket = new TSocket(this.poller);
			TChannel channel = new TChannel(newSocket, host, port, this);
			this.idChannels[channel.Id] = channel;

			return channel;
		}
コード例 #3
0
        public override AChannel ConnectChannel(string host, int port)
        {
            TSocket  newSocket = new TSocket(this.poller);
            TChannel channel   = new TChannel(newSocket, host, port, this);

            this.idChannels[channel.Id] = channel;

            return(channel);
        }
コード例 #4
0
        public override AChannel GetChannel(string host, int port)
        {
            TChannel channel   = null;
            TSocket  newSocket = new TSocket(this.poller);

            channel                     = new TChannel(newSocket, host, port, this);
            channel.OnError            += this.OnChannelError;
            this.idChannels[channel.Id] = channel;
            return(channel);
        }
コード例 #5
0
ファイル: TService.cs プロジェクト: egametang/Egametang
		public override async Task<AChannel> AcceptChannel()
		{
			if (this.acceptor == null)
			{
				throw new Exception("service construct must use host and port param");
			}
			TSocket socket = new TSocket(this.poller);
			await this.acceptor.AcceptAsync(socket);
			TChannel channel = new TChannel(socket, this);
			this.idChannels[channel.Id] = channel;
			return channel;
		}
コード例 #6
0
        public override async Task <AChannel> AcceptChannel()
        {
            if (this.acceptor == null)
            {
                throw new Exception("service construct must use host and port param");
            }
            TSocket socket = new TSocket(this.poller);

            await this.acceptor.AcceptAsync(socket);

            TChannel channel = new TChannel(socket, this);

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

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

            this.poller = null;
        }
コード例 #8
0
        private void Dispose(bool disposing)
        {
            if (this.poller == null)
            {
                return;
            }

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

            this.poller = null;
        }