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


C# INextFilter.ExceptionCaught方法代码示例

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


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

示例1: ExceptionCaught

 public override void ExceptionCaught(INextFilter nextFilter, IoSession session, Exception cause)
 {
     test.testResult += id + "EC";
     nextFilter.ExceptionCaught(session, cause);
 }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:5,代码来源:IoFilterChainTest.cs

示例2: ExceptionCaught

 /// <inheritdoc/>
 public virtual void ExceptionCaught(INextFilter nextFilter, IoSession session, Exception cause)
 {
     nextFilter.ExceptionCaught(session, cause);
 }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:5,代码来源:IoFilterAdapter.cs

示例3: MessageReceived

        /// <inheritdoc/>
        public override void MessageReceived(INextFilter nextFilter, IoSession session, Object message)
        {
            //if (log.IsDebugEnabled)
            //    log.DebugFormat("Processing a MESSAGE_RECEIVED for session {0}", session.Id);

            IoBuffer input = message as IoBuffer;
            if (input == null)
            {
                nextFilter.MessageReceived(session, message);
                return;
            }

            IProtocolDecoder decoder = _factory.GetDecoder(session);
            IProtocolDecoderOutput decoderOutput = GetDecoderOut(session, nextFilter);

            // Loop until we don't have anymore byte in the buffer,
            // or until the decoder throws an unrecoverable exception or
            // can't decoder a message, because there are not enough
            // data in the buffer
            while (input.HasRemaining)
            {
                Int32 oldPos = input.Position;
                try
                {
                    // TODO may not need lock on UDP
                    lock (session)
                    {
                        // Call the decoder with the read bytes
                        decoder.Decode(session, input, decoderOutput);
                    }

                    // Finish decoding if no exception was thrown.
                    decoderOutput.Flush(nextFilter, session);
                }
                catch (Exception ex)
                {
                    ProtocolDecoderException pde = ex as ProtocolDecoderException;
                    if (pde == null)
                        pde = new ProtocolDecoderException(null, ex);
                    if (pde.Hexdump == null)
                    {
                        // Generate a message hex dump
                        Int32 curPos = input.Position;
                        input.Position = oldPos;
                        pde.Hexdump = input.GetHexDump();
                        input.Position = curPos;
                    }

                    decoderOutput.Flush(nextFilter, session);
                    nextFilter.ExceptionCaught(session, pde);

                    // Retry only if the type of the caught exception is
                    // recoverable and the buffer position has changed.
                    // We check buffer position additionally to prevent an
                    // infinite loop.
                    if (!(ex is RecoverableProtocolDecoderException) || input.Position == oldPos)
                        break;
                }
            }
        }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:61,代码来源:ProtocolCodecFilter.cs


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