///// <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); }
/// <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(); }
public override void Read(IChannelHandlerContext context) { //触发开始read,一般都是自动开始接收,所以这里一般不会主动调用的 IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; @unsafe.UnsafeBeginRead(); }
/// <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); }
protected AbstractChannel(IChannelId id, IChannel parent) { Contract.Requires(id != null); Id = id; Parent = parent; // ReSharper disable once VirtualMemberCallInContructor _channelUnsafe = NewUnsafe(); _pipeline = new DefaultChannelPipeline(this); }
public HeadContext(DefaultChannelPipeline pipeline) : base(pipeline, null, HeadName, SkipFlags) { this.channelUnsafe = pipeline.Channel.Unsafe; this.SetAdded(); }
public static void CloseSafe(this IChannelUnsafe u) { CompleteChannelCloseTaskSafely(u, u.CloseAsync()); }
public override Task WriteAsync(IChannelHandlerContext context, object message) { IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; return(@unsafe.UnsafeWriteAsync(message)); }
public override Task CloseAsync(IChannelHandlerContext context) { IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; return(@unsafe.UnsafeCloseAsync()); }
public override Task ConnectAsync(IChannelHandlerContext context, EndPoint remoteAddress) { IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; return(@unsafe.UnsafeConnectAsync(remoteAddress)); }
public override Task BindAsync(IChannelHandlerContext context, EndPoint localAddress) { IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; return(@unsafe.UnsafeBindAsync(localAddress)); }
public override Task DeregisterAsync(IChannelHandlerContext context) { IChannelUnsafe @unsafe = context.Channel as IChannelUnsafe; return(@unsafe.UnsafeDeregisterAsync()); }