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


C# IChannelHandlerContext.SendUpstream方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:jmptrader,项目名称:griffin,代码行数:19,代码来源:AutoReconnector.cs

示例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);
        }
开发者ID:jmptrader,项目名称:griffin,代码行数:32,代码来源:Decoder.cs

示例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);
 }
开发者ID:jmptrader,项目名称:griffin,代码行数:9,代码来源:Decoder.cs


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