本文整理汇总了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);
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}