当前位置: 首页>>代码示例>>C#>>正文


C# IChannelHandlerContext.FireUserEventTriggered方法代码示例

本文整理汇总了C#中IChannelHandlerContext.FireUserEventTriggered方法的典型用法代码示例。如果您正苦于以下问题:C# IChannelHandlerContext.FireUserEventTriggered方法的具体用法?C# IChannelHandlerContext.FireUserEventTriggered怎么用?C# IChannelHandlerContext.FireUserEventTriggered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IChannelHandlerContext的用法示例。


在下文中一共展示了IChannelHandlerContext.FireUserEventTriggered方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UserEventTriggered

 public virtual void UserEventTriggered(IChannelHandlerContext context, object evt) => context.FireUserEventTriggered(evt);
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:1,代码来源:ChannelHandlerAdapter.cs

示例2: NotifyHandshakeFailure

 public static void NotifyHandshakeFailure(IChannelHandlerContext ctx, Exception cause)
 {
     // We have may haven written some parts of data before an exception was thrown so ensure we always flush.
     // See https://github.com/netty/netty/issues/3900#issuecomment-172481830
     ctx.Flush();
     ctx.FireUserEventTriggered(new TlsHandshakeCompletionEvent(cause));
     ctx.CloseAsync();
 }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:8,代码来源:TlsUtils.cs

示例3: Decode

        /// <summary>
        /// Decodes the byte buffer and builds QuickBlockTransfer packets.
        /// </summary>
        /// <param name="context">The handler context.</param>
        /// <param name="input">The input byte buffer from the socket.</param>
        /// <param name="output">The output packets.</param>
        protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
        {
            switch (State)
            {
                case DecoderState.ReSync:
                    if (!input.IsReadable(QuickBlockV1BodySize + FrameSyncBytes)) break;
                    PerformanceCounters.FrameSyncTotal.Increment();
                    if (!SynchronizeFrame(input)) break;
                    State = DecoderState.StartFrame;
                    goto case DecoderState.StartFrame;

                case DecoderState.StartFrame:
                    if (!SkipNullBytes(input)) break;
                    State = DecoderState.FrameType;
                    goto case DecoderState.FrameType;

                case DecoderState.FrameType:
                    if (!input.IsReadable(QuickBlockHeaderSize)) break;
                    if (IsDataBlockHeader(input))
                    {
                        State = DecoderState.BlockHeader;
                        goto case DecoderState.BlockHeader;
                    }
                    if (IsServerList(input))
                    {
                        PerformanceCounters.ServerListReceivedTotal.Increment();
                        State = DecoderState.ServerList;
                        goto case DecoderState.ServerList;
                    }
                    throw new InvalidOperationException("Unknown frame type");

                case DecoderState.ServerList:
                    var content = ReadString(input);
                    if (content.Length == 0) break;
                    context.FireUserEventTriggered(ParseServerList(content));
                    State = DecoderState.StartFrame;
                    goto case DecoderState.StartFrame;

                case DecoderState.BlockHeader:
                    Packet = ParsePacketHeader(input);
                    PerformanceCounters.BlocksReceivedTotal.Increment();
                    if (Packet.Version == 2)
                        PerformanceCounters.CompressedBlocksReceivedTotal.Increment();
                    State = DecoderState.BlockBody;
                    goto case DecoderState.BlockBody;

                case DecoderState.BlockBody:
                    if (!input.IsReadable(Packet.Length)) break;
                    Packet.Content = ReadPacketBody(input, Packet.Length, Packet.Version);
                    PerformanceCounters.BlocksProcessedPerSecond.Increment();
                    State = DecoderState.Validate;
                    goto case DecoderState.Validate;

                case DecoderState.Validate:
                    if (Packet.TotalBlocks <= 0 || Packet.BlockNumber <= 0)
                    {
                        PerformanceCounters.ChecksumErrorsTotal.Increment();
                        throw new InvalidDataException("Header block values out of range. " + Packet);
                    }

                    if (VerifyChecksum(Packet.Content, Packet.Checksum))
                    {
                        ByteBlasterEventSource.Log.PacketCreated(Packet.ToString());
                        context.FireUserEventTriggered(Packet);
                    }
                    else
                    {
                        PerformanceCounters.ChecksumErrorsTotal.Increment();
                        throw new InvalidDataException("Block Checksum failed. " + Packet);
                    }

                    State = DecoderState.StartFrame;
                    goto case DecoderState.StartFrame;

                default:
                    throw new InvalidOperationException("Unknown Decoder State: " + State);
            }
        }
开发者ID:bradsjm,项目名称:DotEmwin,代码行数:84,代码来源:ByteBlasterProtocolDecoder.cs

示例4: UserEventTriggered

 public override void UserEventTriggered(IChannelHandlerContext ctx, object evt)
 {
     if (this.Logger.IsEnabled(this.InternalLevel))
     {
         this.Logger.Log(this.InternalLevel, this.Format(ctx, "USER_EVENT", evt));
     }
     ctx.FireUserEventTriggered(evt);
 }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:8,代码来源:LoggingHandler.cs

示例5: ChannelIdle

 /// <summary>
 /// Is called when an <see cref="IdleStateEvent"/> should be fired. This implementation calls
 /// <see cref="IChannelHandlerContext.FireUserEventTriggered(object)"/>.
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="stateEvent">Evt.</param>
 protected void ChannelIdle(IChannelHandlerContext context, IdleStateEvent stateEvent)
 {
     context.FireUserEventTriggered(stateEvent);
 }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:10,代码来源:IdleStateHandler.cs


注:本文中的IChannelHandlerContext.FireUserEventTriggered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。