コード例 #1
0
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   if (inboundEmitter.requested != 0L) {
     ctx.read();
   } else {
     if (log.isDebugEnabled()) {
       log.debug("Pausing read due to lack of request");
     }
   }
   ctx.fireChannelReadComplete();
 }
コード例 #2
0
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   if (isRemote(ctx)) {
     byte[] data = getPayloadFromByteBuf(buffer);
     LOG.trace(
         "Read complete,send message to remote channel: "
             + routeId
             + ",message is "
             + new String(data));
     broker.sendRequest(new UscRemoteDataMessage(routeId, data, true));
     buffer.clear();
     return;
   }
   // propagate the data to rest of handlers in pipeline
   ctx.fireChannelReadComplete();
 }
コード例 #3
0
ファイル: SslHandler.java プロジェクト: njutony1991/netty
  @Override
  public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    // Discard bytes of the cumulation buffer if needed.
    discardSomeReadBytes();

    if (needsFlush) {
      needsFlush = false;
      ctx.flush();
    }

    // If handshake is not finished yet, we need more data.
    if (!ctx.channel().config().isAutoRead() && (!firedChannelRead || !handshakePromise.isDone())) {
      // No auto-read used and no message passed through the ChannelPipeline or the handhshake was
      // not complete
      // yet, which means we need to trigger the read to ensure we not encounter any stalls.
      ctx.read();
    }

    firedChannelRead = false;
    ctx.fireChannelReadComplete();
  }
コード例 #4
0
  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) {
    if (msg instanceof HttpResponse) {
      this.responseContext = new HttpResponseContext();
      this.responseInformationProcessor = new HttpResponseInformationProcessor();
      this.responseAssertProcessor = new HttpResponseAssertProcessor();
      HttpResponse response = (HttpResponse) msg;
      responseInformationProcessor.process(response, responseContext);
    }

    if (msg instanceof HttpContent) {
      HttpContent httpContent = (HttpContent) msg;
      ByteBuf content = httpContent.content();

      if (content.isReadable()) {
        this.responseInformationProcessor.appendDecoderResult(
            responseContext, httpContent, content);
      }

      if (content instanceof LastHttpContent) {
        ctx.fireChannelReadComplete();
      }
    }
  }
コード例 #5
0
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   System.out.println("channel 读取完毕");
   ctx.fireChannelReadComplete();
 }