Ejemplo n.º 1
0
 ///// <summary>
 // /// Creates a new instance.
 // ///
 // /// @param parent
 // ///        the parent of this channel. {@code null} if there's no parent.
 // /// </summary>
 //protected AbstractChannel(IChannel parent)
 //    : this(DefaultChannelId.NewInstance())
 //{
 //}
 /// <summary>
 /// Creates a new instance.
 ///
 //* @param parent
 //*        the parent of this channel. {@code null} if there's no parent.
 /// </summary>
 protected AbstractChannel(IChannel parent /*, ChannelId id*/)
 {
     this.Parent = parent;
     //this.Id = id;
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="parent">The parent of this channel. Pass <c>null</c> if there's no parent.</param>
 /// <param name="id">An <see cref="IChannelId"/> for the new channel.</param>
 protected AbstractChannel(IChannel parent, IChannelId id)
 {
     this.Parent        = parent;
     this.Id            = id;
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline      = this.NewChannelPipeline();
 }
Ejemplo n.º 3
0
        public override void Read(IChannelHandlerContext context)
        {
            //触发开始read,一般都是自动开始接收,所以这里一般不会主动调用的
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            @unsafe.UnsafeBeginRead();
        }
Ejemplo n.º 4
0
 ///// <summary>
 // /// Creates a new instance.
 // ///
 // /// @param parent
 // ///        the parent of this channel. {@code null} if there's no parent.
 // /// </summary>
 //protected AbstractChannel(IChannel parent)
 //    : this(DefaultChannelId.NewInstance())
 //{
 //}
 /// <summary>
 /// Creates a new instance.
 ///
 //* @param parent
 //*        the parent of this channel. {@code null} if there's no parent.
 /// </summary>
 protected AbstractChannel(IChannel parent /*, ChannelId id*/)
 {
     this.Parent = parent;
     //this.Id = id;
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline      = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Creates a new instance.
 ///     @param parent
 ///     the parent of this channel. {@code null} if there's no parent.
 /// </summary>
 protected AbstractChannel(IChannel parent)
 {
     this.Parent = parent;
     this.Id = this.NewId();
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     Creates a new instance.
 ///     @param parent
 ///     the parent of this channel. {@code null} if there's no parent.
 /// </summary>
 protected AbstractChannel(IChannel parent)
 {
     this.Parent        = parent;
     this.Id            = this.NewId();
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline      = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 7
0
 protected AbstractChannel(IChannelId id, IChannel parent)
 {
     Contract.Requires(id != null);
     Id = id;
     Parent = parent;
     // ReSharper disable once VirtualMemberCallInContructor
     _channelUnsafe = NewUnsafe();
     _pipeline = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 8
0
 protected AbstractChannel(IChannelId id, IChannel parent)
 {
     Contract.Requires(id != null);
     Id     = id;
     Parent = parent;
     // ReSharper disable once VirtualMemberCallInContructor
     _channelUnsafe = NewUnsafe();
     _pipeline      = new DefaultChannelPipeline(this);
 }
Ejemplo n.º 9
0
 public HeadContext(DefaultChannelPipeline pipeline)
     : base(pipeline, null, HeadName, SkipFlags)
 {
     this.channelUnsafe = pipeline.Channel.Unsafe;
     this.SetAdded();
 }
Ejemplo n.º 10
0
 public static void CloseSafe(this IChannelUnsafe u)
 {
     CompleteChannelCloseTaskSafely(u, u.CloseAsync());
 }
Ejemplo n.º 11
0
        public override Task WriteAsync(IChannelHandlerContext context, object message)
        {
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            return(@unsafe.UnsafeWriteAsync(message));
        }
Ejemplo n.º 12
0
        public override Task CloseAsync(IChannelHandlerContext context)
        {
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            return(@unsafe.UnsafeCloseAsync());
        }
Ejemplo n.º 13
0
        public override Task ConnectAsync(IChannelHandlerContext context, EndPoint remoteAddress)
        {
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            return(@unsafe.UnsafeConnectAsync(remoteAddress));
        }
Ejemplo n.º 14
0
        public override Task BindAsync(IChannelHandlerContext context, EndPoint localAddress)
        {
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            return(@unsafe.UnsafeBindAsync(localAddress));
        }
Ejemplo n.º 15
0
        public override Task DeregisterAsync(IChannelHandlerContext context)
        {
            IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe;

            return(@unsafe.UnsafeDeregisterAsync());
        }