@Override protected int doReadBytes(ByteBuf buf) throws Exception { final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes()))); return buf.writeBytes(is, allocHandle.attemptedBytesRead()); }
@Override protected int doReadBytes(ByteBuf buf) throws Exception { final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes()))); return buf.writeBytes(is, allocHandle.attemptedBytesRead()); }
@Override protected int doReadBytes(ByteBuf buf) throws Exception { final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes()))); return buf.writeBytes(is, allocHandle.attemptedBytesRead()); }
@Override protected int doReadMessages(List<Object> buf) throws Exception { DatagramChannelConfig config = config(); final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.reset(config);
final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.reset(config);
final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.reset(config);
/** * Read bytes into the given {@link ByteBuf} and return the amount. */ protected final int doReadBytes(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
@Override protected int doReadMessages(List<Object> buf) throws Exception { DatagramChannelConfig config = config(); final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
/** * Read bytes into the given {@link ByteBuf} and return the amount. */ protected final int doReadBytes(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle(); allocHandle.reset(config);
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object m = inboundBuffer.poll(); if (m == null) { break; } pipeline.fireChannelRead(m); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object received = inboundBuffer.poll(); if (received == null) { break; } pipeline.fireChannelRead(received); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }
@Override protected int doReadMessages(List<Object> buf) throws Exception { DatagramChannelConfig config = config(); final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
/** * Read bytes into the given {@link ByteBuf} and return the amount. */ protected final int doReadBytes(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
/** * Read bytes into the given {@link ByteBuf} and return the amount. */ protected final int doReadBytes(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object m = inboundBuffer.poll(); if (m == null) { break; } pipeline.fireChannelRead(m); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object received = inboundBuffer.poll(); if (received == null) { break; } pipeline.fireChannelRead(received); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object m = inboundBuffer.poll(); if (m == null) { break; } pipeline.fireChannelRead(m); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }
private void readInbound() { RecvByteBufAllocator.Handle handle = unsafe().recvBufAllocHandle(); handle.reset(config()); ChannelPipeline pipeline = pipeline(); do { Object received = inboundBuffer.poll(); if (received == null) { break; } pipeline.fireChannelRead(received); } while (handle.continueReading()); pipeline.fireChannelReadComplete(); }