public void setAutoRead(boolean enableAutoRead) { channel.config().setAutoRead(enableAutoRead); }
@Override public void operationComplete(ChannelFuture future) { if (state == AsyncCommand.COMMAND_WRITE) { state = AsyncCommand.COMMAND_READ_HEADER; commandSentCounter++; } else { state = AsyncCommand.AUTH_READ_HEADER; } command.dataOffset = 0; // Socket timeout applies only to read events. // Reset event received because we are switching from a write to a read state. // This handles case where write succeeds and read event does not occur. If we didn't reset, // the socket timeout would go through two iterations (double the timeout) because a write // event occurred in the first timeout period. eventReceived = false; conn.channel.config().setAutoRead(true); } });
@Override public void operationComplete(ChannelFuture future) { if (state == AsyncCommand.COMMAND_WRITE) { state = AsyncCommand.COMMAND_READ_HEADER; commandSentCounter++; } else { state = AsyncCommand.AUTH_READ_HEADER; } command.dataOffset = 0; // Socket timeout applies only to read events. // Reset event received because we are switching from a write to a read state. // This handles case where write succeeds and read event does not occur. If we didn't reset, // the socket timeout would go through two iterations (double the timeout) because a write // event occurred in the first timeout period. eventReceived = false; conn.channel.config().setAutoRead(true); } });
private final void putConnection() { conn.channel.config().setAutoRead(false); InboundHandler handler = (InboundHandler)conn.channel.pipeline().last(); handler.command = null; conn.updateLastUsed(); command.node.putAsyncConnection(conn, eventState.index); }
private final void putConnection() { conn.channel.config().setAutoRead(false); InboundHandler handler = (InboundHandler)conn.channel.pipeline().last(); handler.command = null; conn.updateLastUsed(); command.node.putAsyncConnection(conn, eventState.index); }
@Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); new ConnectionIdleTimeout(pipeline, serverConfig.getIdleTimeout()); if (sslContext != null) { SSLEngine sslEngine = sslContext.newEngine(PooledByteBufAllocator.DEFAULT); pipeline.addLast("ssl", new SslHandler(sslEngine)); } pipeline.addLast("decoder", new HttpRequestDecoder( serverConfig.getMaxInitialLineLength(), serverConfig.getMaxHeaderSize(), serverConfig.getMaxChunkSize(), false) ); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new IgnorableHttpContentCompressor()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("adapter", handlerAdapter); ch.config().setAutoRead(false); } })
@Override public void initChannel(final SocketChannel ch) throws Exception { ch.config().setConnectTimeoutMillis(getOptions().timeout()); if (null != getSslOptions()) { addSecureHandler(ch); } else { ch.config().setAutoRead(false); } if (null != nettyOptions && null != nettyOptions.pipelineConfigurer()) { nettyOptions.pipelineConfigurer().accept(ch.pipeline()); } bindChannel(targetHandler, ch); } });