public void OnAccept(AChannel channel) { Session session = ObjectFactory.CreateEntity <Session>(); session.Awake(this, channel); this.sessions.Add(session.InstanceId, session); }
/// <summary> /// 创建一个新Session /// </summary> public Session Create(IPEndPoint ipEndPoint) { AChannel channel = this.Service.ConnectChannel(ipEndPoint); Session session = ObjectFactory.CreateEntity <Session>(); session.Awake(this, channel); this.sessions.Add(session.InstanceId, session); return(session); }
public void Awake(NetworkComponent net, AChannel aChannel) { this.Network = net; this.Error = 0; this.channel = aChannel; this.requestCallback.Clear(); ulong id = this.InstanceId; channel.ErrorCallback += (c, e) => { this.Error = e; this.Network.Remove(id); }; channel.ReadCallback += this.OnRead; this.channel.Start(); }
protected void OnAccept(AChannel channel) { this.acceptCallback.Invoke(channel); }