예제 #1
0
파일: Session.cs 프로젝트: xushouqi/XMoat
        public Session(NetworkComponent netcom, AChannel ch)
        {
            //this.Id = IdGenerater.GenerateId();
            this.network = netcom;
            this.channel = ch;
            this.requestCallback.Clear();

            this.StartRecvAsync();
        }
예제 #2
0
        public virtual async Task <AChannel> Accept()
        {
            AChannel channel = await this.Service.AcceptChannelAsync();

            Session session = new Session(this, channel);

            this.AddSession(session);
            channel.ErrorCallback += (c, e) => { this.RemoveSession(session.Id); };
            channel.ErrorCallback += OnNetworkError;
            return(channel);
        }
예제 #3
0
파일: AChannel.cs 프로젝트: xushouqi/XMoat
 protected void OnError(AChannel channel, SocketError e)
 {
     this.errorCallback?.Invoke(channel, e);
 }
예제 #4
0
 private void OnNetworkError(AChannel channel, SocketError error)
 {
     Log.Error($"ChannelError: {channel.Id}: {error.ToString()}");
 }