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


C# IChannelHandlerContext.FireChannelRead方法代码示例

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


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

示例1: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     if (message is IByteBuf)
     {
         var buf = (IByteBuf) message;
         var integer = buf.ReadInt();
         if (ReleaseMessages)
             ReferenceCountUtil.SafeRelease(message);
         context.FireChannelRead(integer);
     }
     else
     {
         context.FireChannelRead(message);
     }
 }
开发者ID:helios-io,项目名称:helios,代码行数:15,代码来源:IntCodec.cs

示例2: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     var buffer = (IByteBuffer)message;
     var data = buffer.ToArray();
     var transportMessage = _serializer.Deserialize<byte[], TransportMessage>(data);
     context.FireChannelRead(transportMessage);
 }
开发者ID:xiongeee,项目名称:Rpc,代码行数:7,代码来源:TransportMessageChannelHandlerAdapter.cs

示例3: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     if (++_actualReads == _expectedReads)
     {
         _signal.Signal();
     }
     context.FireChannelRead(message);
 }
开发者ID:helios-io,项目名称:helios,代码行数:8,代码来源:ReadFinishedHandler.cs

示例4: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     var packet = message as PublishPacket;
     if (packet != null)
     {
         IByteBuffer result = ApplyCompression(packet.Payload, CompressionMode.Decompress);
         packet.Payload = result;
     }
     context.FireChannelRead(message);
 }
开发者ID:kdotchkoff,项目名称:azure-iot-protocol-gateway,代码行数:10,代码来源:MqttPacketPayloadCompressionHandler.cs

示例5: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     context.FireChannelRead(first);
     context.FireChannelRead(second);
 }
开发者ID:helios-io,项目名称:helios,代码行数:5,代码来源:EmbeddedChannelTest.cs

示例6: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     this.throughput.Increment();
     context.FireChannelRead(message);
 }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:5,代码来源:CounterHandlerInbound.cs

示例7: ChannelRead

        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            if (message is IByteBuf)
            {
                ReadInstruction mode;
                var buf = (IByteBuf) message;
                mode = _instructions.Any() && buf.ReadableBytes > 4 ? _instructions.Dequeue() : ReadInstruction.Full;

                if (mode.Mode == ReadMode.Full)
                {
                    var writeBuf =
                        context.Allocator.Buffer(_cumulativeBuffer.ReadableBytes + buf.ReadableBytes)
                            .WriteBytes(_cumulativeBuffer)
                            .WriteBytes(buf);
                    Assert.Equal(0, _cumulativeBuffer.ReadableBytes);
                    // verify that we've fully drained the cumulative buffer
                    _cumulativeBuffer.DiscardReadBytes();
                    context.FireChannelRead(writeBuf);
                }
                else
                {
                    var originalBytes = buf.ReadableBytes;
                    var partialReadBytes = mode.ReadBytes;
                    var writeBuf =
                        context.Allocator.Buffer(_cumulativeBuffer.ReadableBytes + partialReadBytes)
                            .WriteBytes(_cumulativeBuffer)
                            .WriteBytes(buf, partialReadBytes);
                    Assert.Equal(0, _cumulativeBuffer.ReadableBytes);
                    // verify that we've fully drained the cumulative buffer
                    _cumulativeBuffer.DiscardReadBytes();

                    // store the rest partial read into the cumulative buffer
                    _cumulativeBuffer.WriteBytes(buf, partialReadBytes, buf.ReadableBytes);
                    Assert.Equal(partialReadBytes + _cumulativeBuffer.ReadableBytes, originalBytes);

                    context.FireChannelRead(writeBuf);
                }
            }
            else
            {
                // move onto the next handler if this message is not an IByteBuf
                context.FireChannelRead(message);
            }
        }
开发者ID:helios-io,项目名称:helios,代码行数:44,代码来源:EncodingGenerators.cs

示例8: UserEventTriggered

 public override void UserEventTriggered(IChannelHandlerContext context, object evt)
 {
     if (evt is FinishPartialReads)
     {
         if (_cumulativeBuffer.IsReadable())
         {
             var writeBuf =
                 context.Allocator.Buffer(_cumulativeBuffer.ReadableBytes)
                     .WriteBytes(_cumulativeBuffer);
             context.FireChannelRead(writeBuf);
         }
     }
 }
开发者ID:helios-io,项目名称:helios,代码行数:13,代码来源:EncodingGenerators.cs

示例9: ChannelRead

        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            if (message is IByteBuf)
            {
                var output = RecyclableArrayList.Take();
                try
                {
                    var data = (IByteBuf) message;
                    _first = _cumulation == null;
                    if (_first)
                    {
                        _cumulation = data;
                    }
                    else
                    {
                        _cumulation = _cumulator(context.Allocator, _cumulation, data);
                    }
                    CallDecode(context, _cumulation, output);
                }
                catch (DecoderException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new DecoderException(ex);
                }
                finally
                {
                    if (_cumulation != null && !_cumulation.IsReadable())
                    {
                        _numReads = 0;
                        _cumulation.Release();
                        _cumulation = null;
                    }
                    else if (++_numReads >= _discardAfterReads)
                    {
                        _numReads = 0;
                        DiscardSomeReadBytes();
                    }

                    var size = output.Count;
                    _decodeWasNull = size == 0;
                    FireChannelRead(context, output, size);
                    output.Return();
                }
            }
            else
            {
                // not a byte buffer? then we can't handle it. Forward it along 
                context.FireChannelRead(message);
            }
        }
开发者ID:helios-io,项目名称:helios,代码行数:53,代码来源:ByteToMessageDecoder.cs

示例10: ChannelInactive

 public override void ChannelInactive(IChannelHandlerContext ctx)
 {
     ThreadLocalObjectList output = ThreadLocalObjectList.Take();
     try
     {
         if (this.cumulation != null)
         {
             this.CallDecode(ctx, this.cumulation, output);
             this.DecodeLast(ctx, this.cumulation, output);
         }
         else
         {
             this.DecodeLast(ctx, Unpooled.Empty, output);
         }
     }
     catch (DecoderException e)
     {
         throw e;
     }
     catch (Exception e)
     {
         throw new DecoderException(e);
     }
     finally
     {
         try
         {
             if (this.cumulation != null)
             {
                 this.cumulation.Release();
                 this.cumulation = null;
             }
             int size = output.Count;
             for (int i = 0; i < size; i++)
             {
                 ctx.FireChannelRead(output[i]);
             }
             if (size > 0)
             {
                 // Something was read, call fireChannelReadComplete()
                 ctx.FireChannelReadComplete();
             }
             ctx.FireChannelInactive();
         }
         finally
         {
             // recycle in all cases
             output.Return();
         }
     }
 }
开发者ID:l1183479157,项目名称:DotNetty,代码行数:51,代码来源:ByteToMessageDecoder.cs

示例11: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     if (++_actualReadCount == _expectedReadCount)
         _resetEvent.Set();
     context.FireChannelRead(message);
 }
开发者ID:helios-io,项目名称:helios,代码行数:6,代码来源:ReadCountAwaiter.cs

示例12: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     this.reading = true;
     context.FireChannelRead(message);
 }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:5,代码来源:ReadTimeoutHandler.cs

示例13: ChannelRead

        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            if (this.readerIdleTime.Ticks > 0 || this.allIdleTime.Ticks > 0)
            {
                this.reading = true;
                this.firstReaderIdleEvent = this.firstAllIdleEvent = true;
            }

            context.FireChannelRead(message);
        }
开发者ID:RabbitTeam,项目名称:DotNetty,代码行数:10,代码来源:IdleStateHandler.cs

示例14: ChannelRead

 public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     if (message == _upgradeMessage)
     {
         context.Pipeline.Remove(_decoder);
         return;
     }
     context.FireChannelRead(message);
 }
开发者ID:helios-io,项目名称:helios,代码行数:9,代码来源:ByteToMessageDecoderSpecs.cs

示例15: FireChannelRead

 private static void FireChannelRead(IChannelHandlerContext context, List<object> msgs, int numElements)
 {
     for (var i = 0; i < numElements; i++)
         context.FireChannelRead(msgs[i]);
 }
开发者ID:helios-io,项目名称:helios,代码行数:5,代码来源:ByteToMessageDecoder.cs


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