@Override public KQueueRecvByteAllocatorHandle recvBufAllocHandle() { if (allocHandle == null) { allocHandle = new KQueueRecvByteAllocatorHandle( (RecvByteBufAllocator.ExtendedHandle) super.recvBufAllocHandle()); } return allocHandle; }
allocHandle.reset(config); readReadyBefore(); byteBuf = allocHandle.allocate(allocator); allocHandle.lastBytesRead(doReadBytes(byteBuf)); if (allocHandle.lastBytesRead() <= 0) { close = allocHandle.lastBytesRead() < 0; if (close) { allocHandle.incMessagesRead(1); readPending = false; pipeline.fireChannelRead(byteBuf); } while (allocHandle.continueReading()); allocHandle.readComplete(); pipeline.fireChannelReadComplete();
@Override public int guess() { return overrideGuess ? guess0() : delegate.guess(); }
final void readReadyFinally(ChannelConfig config) { maybeMoreDataToRead = allocHandle.maybeMoreDataToRead(); if (allocHandle.isReadEOF() || (readPending && maybeMoreDataToRead)) { // trigger a read again as there may be something left to read and because of ET we // will not get notified again until we read everything from the socket // // It is possible the last fireChannelRead call could cause the user to call read() again, or if // autoRead is true the call to channelReadComplete would also call read, but maybeMoreDataToRead is set // to false before every read operation to prevent re-entry into readReady() we will not read from // the underlying OS again unless the user happens to call read again. executeReadReadyRunnable(config); } else if (!readPending && !config.isAutoRead()) { // Check if there is a readPending which was not processed yet. // This could be for two reasons: // * The user called Channel.read() or ChannelHandlerContext.read() in channelRead(...) method // * The user called Channel.read() or ChannelHandlerContext.read() in channelReadComplete(...) method // // See https://github.com/netty/netty/issues/2254 clearReadFilter0(); } }
@Override public boolean get() { return maybeMoreDataToRead(); } };
abstract void readReady(KQueueRecvByteAllocatorHandle allocHandle);
private void handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, KQueueRecvByteAllocatorHandle allocHandle) { if (byteBuf != null) { if (byteBuf.isReadable()) { readPending = false; pipeline.fireChannelRead(byteBuf); } else { byteBuf.release(); } } if (!failConnectPromise(cause)) { allocHandle.readComplete(); pipeline.fireChannelReadComplete(); pipeline.fireExceptionCaught(cause); if (close || cause instanceof IOException) { shutdownInput(false); } } } }
final void readReadyFinally(ChannelConfig config) { maybeMoreDataToRead = allocHandle.maybeMoreDataToRead(); if (allocHandle.isReadEOF() || (readPending && maybeMoreDataToRead)) { // trigger a read again as there may be something left to read and because of ET we // will not get notified again until we read everything from the socket // // It is possible the last fireChannelRead call could cause the user to call read() again, or if // autoRead is true the call to channelReadComplete would also call read, but maybeMoreDataToRead is set // to false before every read operation to prevent re-entry into readReady() we will not read from // the underlying OS again unless the user happens to call read again. executeReadReadyRunnable(config); } else if (!readPending && !config.isAutoRead()) { // Check if there is a readPending which was not processed yet. // This could be for two reasons: // * The user called Channel.read() or ChannelHandlerContext.read() in channelRead(...) method // * The user called Channel.read() or ChannelHandlerContext.read() in channelReadComplete(...) method // // See https://github.com/netty/netty/issues/2254 clearReadFilter0(); } }
@Override public boolean get() { return maybeMoreDataToRead(); } };
abstract void readReady(KQueueRecvByteAllocatorHandle allocHandle);
private void handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, KQueueRecvByteAllocatorHandle allocHandle) { if (byteBuf != null) { if (byteBuf.isReadable()) { readPending = false; pipeline.fireChannelRead(byteBuf); } else { byteBuf.release(); } } if (!failConnectPromise(cause)) { allocHandle.readComplete(); pipeline.fireChannelReadComplete(); pipeline.fireExceptionCaught(cause); if (close || cause instanceof IOException) { shutdownInput(false); } } } }
allocHandle.reset(config); readReadyBefore(); switch(recvFd) { case 0: allocHandle.lastBytesRead(0); break readLoop; case -1: allocHandle.lastBytesRead(-1); close(voidPromise()); return; default: allocHandle.lastBytesRead(1); allocHandle.incMessagesRead(1); readPending = false; pipeline.fireChannelRead(new FileDescriptor(recvFd)); break; } while (allocHandle.continueReading()); allocHandle.readComplete(); pipeline.fireChannelReadComplete(); } catch (Throwable t) { allocHandle.readComplete(); pipeline.fireChannelReadComplete(); pipeline.fireExceptionCaught(t);
final void readReadyFinally(ChannelConfig config) { maybeMoreDataToRead = allocHandle.maybeMoreDataToRead(); if (allocHandle.isReadEOF() || (readPending && maybeMoreDataToRead)) { // trigger a read again as there may be something left to read and because of ET we // will not get notified again until we read everything from the socket // // It is possible the last fireChannelRead call could cause the user to call read() again, or if // autoRead is true the call to channelReadComplete would also call read, but maybeMoreDataToRead is set // to false before every read operation to prevent re-entry into readReady() we will not read from // the underlying OS again unless the user happens to call read again. executeReadReadyRunnable(config); } else if (!readPending && !config.isAutoRead()) { // Check if there is a readPending which was not processed yet. // This could be for two reasons: // * The user called Channel.read() or ChannelHandlerContext.read() in channelRead(...) method // * The user called Channel.read() or ChannelHandlerContext.read() in channelReadComplete(...) method // // See https://github.com/netty/netty/issues/2254 clearReadFilter0(); } }
@Override public int guess() { return overrideGuess ? guess0() : delegate.guess(); }
@Override public boolean get() { return maybeMoreDataToRead(); } };
@Override public KQueueRecvByteAllocatorHandle recvBufAllocHandle() { if (allocHandle == null) { allocHandle = new KQueueRecvByteAllocatorHandle( (RecvByteBufAllocator.ExtendedHandle) super.recvBufAllocHandle()); } return allocHandle; }
abstract void readReady(KQueueRecvByteAllocatorHandle allocHandle);
private void handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, KQueueRecvByteAllocatorHandle allocHandle) { if (byteBuf != null) { if (byteBuf.isReadable()) { readPending = false; pipeline.fireChannelRead(byteBuf); } else { byteBuf.release(); } } if (!failConnectPromise(cause)) { allocHandle.readComplete(); pipeline.fireChannelReadComplete(); pipeline.fireExceptionCaught(cause); if (close || cause instanceof IOException) { shutdownInput(false); } } } }
allocHandle.reset(config); allocHandle.attemptedBytesRead(1); readReadyBefore(); if (acceptFd == -1) { allocHandle.lastBytesRead(-1); break; allocHandle.lastBytesRead(1); allocHandle.incMessagesRead(1); } while (allocHandle.continueReading()); } catch (Throwable t) { exception = t; allocHandle.readComplete(); pipeline.fireChannelReadComplete();
final void readReadyFinally(ChannelConfig config) { maybeMoreDataToRead = allocHandle.maybeMoreDataToRead(); if (allocHandle.isReadEOF() || (readPending && maybeMoreDataToRead)) { // trigger a read again as there may be something left to read and because of ET we // will not get notified again until we read everything from the socket // // It is possible the last fireChannelRead call could cause the user to call read() again, or if // autoRead is true the call to channelReadComplete would also call read, but maybeMoreDataToRead is set // to false before every read operation to prevent re-entry into readReady() we will not read from // the underlying OS again unless the user happens to call read again. executeReadReadyRunnable(config); } else if (!readPending && !config.isAutoRead()) { // Check if there is a readPending which was not processed yet. // This could be for two reasons: // * The user called Channel.read() or ChannelHandlerContext.read() in channelRead(...) method // * The user called Channel.read() or ChannelHandlerContext.read() in channelReadComplete(...) method // // See https://github.com/netty/netty/issues/2254 clearReadFilter0(); } }