예제 #1
0
        public virtual Session OnAccept(AChannel channel)
        {
            Session session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel);

            this.Sessions.Add(session.Id, session);
            channel.Start();
            return(session);
        }
예제 #2
0
        /// <summary>
        /// 创建一个新Session
        /// </summary>
        public Session Create(string address)
        {
            AChannel channel = this.Service.ConnectChannel(address);
            Session  session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel);

            this.Sessions.Add(session.Id, session);
            channel.Start();
            return(session);
        }
예제 #3
0
        /// <summary>
        /// 创建一个新Session
        /// </summary>
        public Session Create(IPEndPoint ipEndPoint)
        {
            AChannel channel = this.Service.ConnectChannel(ipEndPoint);
            Session  session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel);

            this.Sessions.Add(session.Id, session);
            channel.Start();
            return(session);
        }
예제 #4
0
        public KChannel GetKChannel(long id)
        {
            AChannel aChannel = this.GetChannel(id);

            if (aChannel == null)
            {
                return(null);
            }

            return((KChannel)aChannel);
        }
예제 #5
0
파일: Session.cs 프로젝트: x1766233/DCET
        public void Awake(AChannel aChannel)
        {
            long timeNow = TimeHelper.Now();

            this.LastRecvTime = timeNow;
            this.LastSendTime = timeNow;

            this.channel = aChannel;
            this.requestCallback.Clear();
            long id = this.Id;

            channel.ErrorCallback += (c, e) =>
            {
                this.Network.Remove(id);
            };
            channel.ReadCallback += this.OnRead;
        }
예제 #6
0
        public static void Output(IntPtr bytes, int count, IntPtr user)
        {
            if (Instance == null)
            {
                return;
            }
            AChannel aChannel = Instance.GetChannel((uint)user);

            if (aChannel == null)
            {
                Log.Error($"not found kchannel, {(uint)user}");
                return;
            }

            KChannel kChannel = aChannel as KChannel;

            kChannel.Output(bytes, count);
        }
예제 #7
0
파일: AService.cs 프로젝트: x1766233/DCET
 protected void OnAccept(AChannel channel)
 {
     this.acceptCallback.Invoke(channel);
 }