private void OnClientShutdown(TcpChannel channel) { channel.onShutdown -= OnClientShutdown; //先添加到集合,稍后处理,现在处理则ChannelList会异常 _shutdownSet.Add(channel); }
private void OnShutdown(TcpChannel obj) { Channel = null; onDisconnect?.Invoke(this); }
void InitChannel(Socket socket, int bufferSize) { Channel = new TcpChannel(socket, bufferSize); Channel.onReceiveData += OnReceiveData; Channel.onShutdown += OnShutdown; }