示例#1
0
文件: KService.cs 项目: taigacon/ET
        private KChannel CreateAcceptChannel(IPEndPoint remoteEndPoint, uint remoteConn)
        {
            KChannel channel = new KChannel(++this.IdGenerater, remoteConn, this.socket, remoteEndPoint, this);
            KChannel oldChannel;

            if (this.idChannels.TryGetValue(channel.Id, out oldChannel))
            {
                this.idChannels.Remove(oldChannel.Id);
                oldChannel.Dispose();
            }
            this.idChannels[channel.Id] = channel;
            return(channel);
        }
示例#2
0
文件: KService.cs 项目: taigacon/ET
        public override AChannel ConnectChannel(IPEndPoint remoteEndPoint)
        {
            uint     conv    = (uint)RandomHelper.RandomNumber(1000, int.MaxValue);
            KChannel channel = new KChannel(conv, this.socket, remoteEndPoint, this);
            KChannel oldChannel;

            if (this.idChannels.TryGetValue(channel.Id, out oldChannel))
            {
                this.idChannels.Remove(oldChannel.Id);
                oldChannel.Dispose();
            }
            this.idChannels[channel.Id] = channel;
            return(channel);
        }