public static void RemoveChannelIfDisconnected(DotNetty.Transport.Channels.IChannel ch) { if (ch != null && ch.Active) { ChannelMap.TryRemove(ch, out NettyChannel channel); } }
public static NettyChannel GetOrAddChannel(DotNetty.Transport.Channels.IChannel ch, URL url, IChannelHandler handler) { if (ch == null) { return(null); } if (!ChannelMap.ContainsKey(ch)) { var nettyChannel = new NettyChannel(ch, url, handler); ChannelMap.TryAdd(ch, nettyChannel); } return(ChannelMap[ch]); }
public NettyChannel(DotNetty.Transport.Channels.IChannel channel, URL url, IChannelHandler handler) : base(url, handler) { _channel = channel ?? throw new ArgumentException("netty channel==null"); }