本文整理汇总了C#中IChannelHandlerContext.SendUpstream方法的典型用法代码示例。如果您正苦于以下问题:C# IChannelHandlerContext.SendUpstream方法的具体用法?C# IChannelHandlerContext.SendUpstream怎么用?C# IChannelHandlerContext.SendUpstream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IChannelHandlerContext
的用法示例。
在下文中一共展示了IChannelHandlerContext.SendUpstream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleUpstream
/// <summary>
/// Process data that was received from the channel.
/// </summary>
/// <param name="ctx">Context which is used for the currently processed channel</param>
/// <param name="e">Event being processed.</param>
public void HandleUpstream(IChannelHandlerContext ctx, IChannelEvent e)
{
if (e is ClosedEvent)
{
_timer = new Timer(OnTryReconnect, ctx, _interval, TimeSpan.Zero);
ctx.SendUpstream(e);
}
else if (e is ConnectedEvent)
{
_timer.Dispose();
_timer = null;
ctx.SendUpstream(e);
}
}
示例2: HandleUpstream
/// <summary>
/// Process data that was received from the channel.
/// </summary>
/// <param name="ctx">Context which is used for the currently processed channel</param>
/// <param name="e">Event being processed.</param>
public void HandleUpstream(IChannelHandlerContext ctx, IChannelEvent e)
{
if (e is ConnectedEvent)
{
ctx.State = new Context();
}
if (e is ClosedEvent)
{
Reset();
}
else if (e is MessageEvent)
{
_context = ctx.State.As<Context>();
_context._buffer = e.As<MessageEvent>().Message.As<BufferSlice>();
_context._reader.Assign(_context._buffer);
while (_context._parserMethod()) ;
if (_context._isComplete)
{
e.As<MessageEvent>().Message = _context._message;
OnComplete(ctx, e);
}
return;
}
ctx.SendUpstream(e);
}
示例3: OnComplete
/// <summary>
/// Called when a message has been parsed successfully.
/// </summary>
/// <param name="ctx"></param>
/// <param name="channelEvent"></param>
protected virtual void OnComplete(IChannelHandlerContext ctx, IChannelEvent channelEvent)
{
ctx.SendUpstream(channelEvent);
}