public static MessageHandler Create(Type handlerType, NetChannel channel) { var handler = (MessageHandler)PopoObjectPool.Fetch(handlerType, channel); handler.Channel = channel; return(handler); }
public static T Create <T>(NetChannel channel) where T : MessageHandler { var type = typeof(T); var handler = (T)PopoObjectPool.Fetch(typeof(T), channel); return(handler); }
private void CreateMessageHandlers(NetChannel channel) { foreach (var type in handlerTypes) { MessageHandlerFactory.Create(type, channel); } }
private async void OnChannelError(NetChannel channel, SocketError socketError) { if (channel.ChannelType == ChannelType.Client) { if (!await channel.ReConnecting()) { channel.Close(); } else { return; } } else { channel.DisConnect(); } Channels.TryRemove(channel.ObjectId, out NetChannel valu); }
public MessageHandler(NetChannel channel, int handlerId) { this.Channel = channel; this.Channel.OnClose += () => { this.Close(); }; }
public MessageDistribute(NetChannel channel, int handlerId) : base(channel, handlerId) { }