Ejemplo n.º 1
0
 public static void RemoveChannelIfDisconnected(DotNetty.Transport.Channels.IChannel ch)
 {
     if (ch != null && ch.Active)
     {
         ChannelMap.TryRemove(ch, out NettyChannel channel);
     }
 }
Ejemplo n.º 2
0
        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]);
        }
Ejemplo n.º 3
0
 public NettyChannel(DotNetty.Transport.Channels.IChannel channel, URL url, IChannelHandler handler) : base(url, handler)
 {
     _channel = channel ?? throw new ArgumentException("netty channel==null");
 }