2014-02-15 22:26:36 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2014 The Netty Project
|
|
|
|
*
|
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
package io.netty.channel.epoll;
|
|
|
|
|
2014-08-05 14:24:49 +02:00
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
import io.netty.buffer.ByteBufAllocator;
|
|
|
|
import io.netty.buffer.ByteBufUtil;
|
|
|
|
import io.netty.buffer.Unpooled;
|
2014-02-15 22:26:36 +01:00
|
|
|
import io.netty.channel.AbstractChannel;
|
|
|
|
import io.netty.channel.Channel;
|
|
|
|
import io.netty.channel.ChannelMetadata;
|
2015-08-04 02:58:37 +02:00
|
|
|
import io.netty.channel.ChannelOption;
|
2014-02-15 22:26:36 +01:00
|
|
|
import io.netty.channel.EventLoop;
|
2015-06-05 03:36:55 +02:00
|
|
|
import io.netty.channel.RecvByteBufAllocator;
|
2015-08-04 02:58:37 +02:00
|
|
|
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
2015-02-12 20:44:36 +01:00
|
|
|
import io.netty.channel.unix.FileDescriptor;
|
|
|
|
import io.netty.channel.unix.UnixChannel;
|
2014-08-05 14:24:49 +02:00
|
|
|
import io.netty.util.ReferenceCountUtil;
|
2014-04-10 08:27:27 +02:00
|
|
|
import io.netty.util.internal.OneTimeTask;
|
2014-02-15 22:26:36 +01:00
|
|
|
|
2015-04-30 09:38:35 +02:00
|
|
|
import java.io.IOException;
|
2014-02-15 22:26:36 +01:00
|
|
|
import java.net.InetSocketAddress;
|
2015-01-14 16:38:46 +01:00
|
|
|
import java.nio.ByteBuffer;
|
2014-03-16 16:29:45 +01:00
|
|
|
import java.nio.channels.UnresolvedAddressException;
|
2014-02-15 22:26:36 +01:00
|
|
|
|
2015-02-12 20:44:36 +01:00
|
|
|
abstract class AbstractEpollChannel extends AbstractChannel implements UnixChannel {
|
2015-06-05 03:36:55 +02:00
|
|
|
private static final ChannelMetadata METADATA = new ChannelMetadata(false);
|
2014-02-15 22:26:36 +01:00
|
|
|
private final int readFlag;
|
2015-03-01 19:36:31 +01:00
|
|
|
private final FileDescriptor fileDescriptor;
|
2015-01-29 06:49:14 +01:00
|
|
|
protected int flags = Native.EPOLLET;
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
protected volatile boolean active;
|
2015-08-04 02:58:37 +02:00
|
|
|
private volatile boolean inputShutdown;
|
2014-02-15 22:26:36 +01:00
|
|
|
|
2014-04-11 21:08:26 +02:00
|
|
|
AbstractEpollChannel(int fd, int flag) {
|
|
|
|
this(null, fd, flag, false);
|
2014-02-17 14:25:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractEpollChannel(Channel parent, int fd, int flag, boolean active) {
|
2015-02-12 20:44:36 +01:00
|
|
|
this(parent, new FileDescriptor(fd), flag, active);
|
2015-02-05 10:40:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractEpollChannel(Channel parent, FileDescriptor fd, int flag, boolean active) {
|
2014-02-15 22:26:36 +01:00
|
|
|
super(parent);
|
2015-02-05 10:40:41 +01:00
|
|
|
if (fd == null) {
|
|
|
|
throw new NullPointerException("fd");
|
|
|
|
}
|
2014-02-15 22:26:36 +01:00
|
|
|
readFlag = flag;
|
|
|
|
flags |= flag;
|
2014-02-17 14:25:17 +01:00
|
|
|
this.active = active;
|
2015-02-05 10:40:41 +01:00
|
|
|
fileDescriptor = fd;
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
2015-04-30 09:38:35 +02:00
|
|
|
void setFlag(int flag) throws IOException {
|
2015-01-29 06:49:14 +01:00
|
|
|
if (!isFlagSet(flag)) {
|
|
|
|
flags |= flag;
|
|
|
|
modifyEvents();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-30 09:38:35 +02:00
|
|
|
void clearFlag(int flag) throws IOException {
|
2015-01-29 06:49:14 +01:00
|
|
|
if (isFlagSet(flag)) {
|
|
|
|
flags &= ~flag;
|
|
|
|
modifyEvents();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean isFlagSet(int flag) {
|
|
|
|
return (flags & flag) != 0;
|
|
|
|
}
|
|
|
|
|
2015-02-12 20:44:36 +01:00
|
|
|
@Override
|
2015-01-15 14:38:14 +01:00
|
|
|
public final FileDescriptor fd() {
|
|
|
|
return fileDescriptor;
|
2015-01-14 16:38:46 +01:00
|
|
|
}
|
|
|
|
|
2015-01-29 06:49:14 +01:00
|
|
|
@Override
|
|
|
|
public abstract EpollChannelConfig config();
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
@Override
|
|
|
|
public boolean isActive() {
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ChannelMetadata metadata() {
|
2015-06-05 03:36:55 +02:00
|
|
|
return METADATA;
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void doClose() throws Exception {
|
2015-09-22 17:00:16 +02:00
|
|
|
boolean active = this.active;
|
|
|
|
this.active = false;
|
|
|
|
FileDescriptor fd = fileDescriptor;
|
2015-05-04 15:40:29 +02:00
|
|
|
try {
|
2015-09-22 17:00:16 +02:00
|
|
|
// deregister from epoll now and shutdown the socket.
|
2015-05-04 15:40:29 +02:00
|
|
|
doDeregister();
|
2015-09-22 17:00:16 +02:00
|
|
|
if (active) {
|
|
|
|
shutdown(fd.intValue());
|
|
|
|
}
|
2015-05-04 15:40:29 +02:00
|
|
|
} finally {
|
|
|
|
// Ensure the file descriptor is closed in all cases.
|
|
|
|
fd.close();
|
|
|
|
}
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
2015-09-22 17:00:16 +02:00
|
|
|
/**
|
|
|
|
* Called on {@link #doClose()} before the actual {@link FileDescriptor} is closed.
|
|
|
|
* This implementation does nothing.
|
|
|
|
*/
|
|
|
|
protected void shutdown(int fd) throws IOException {
|
|
|
|
// NOOP
|
|
|
|
}
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
@Override
|
|
|
|
protected void doDisconnect() throws Exception {
|
|
|
|
doClose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean isCompatible(EventLoop loop) {
|
|
|
|
return loop instanceof EpollEventLoop;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isOpen() {
|
2015-03-01 19:36:31 +01:00
|
|
|
return fileDescriptor.isOpen();
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void doDeregister() throws Exception {
|
|
|
|
((EpollEventLoop) eventLoop()).remove(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void doBeginRead() throws Exception {
|
2014-08-05 14:24:49 +02:00
|
|
|
// Channel.read() or ChannelHandlerContext.read() was called
|
|
|
|
((AbstractEpollUnsafe) unsafe()).readPending = true;
|
|
|
|
|
2015-01-29 06:49:14 +01:00
|
|
|
setFlag(readFlag);
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
2014-04-10 08:27:27 +02:00
|
|
|
final void clearEpollIn() {
|
2014-04-22 10:14:31 +02:00
|
|
|
// Only clear if registered with an EventLoop as otherwise
|
|
|
|
if (isRegistered()) {
|
|
|
|
final EventLoop loop = eventLoop();
|
|
|
|
final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe();
|
|
|
|
if (loop.inEventLoop()) {
|
|
|
|
unsafe.clearEpollIn0();
|
|
|
|
} else {
|
|
|
|
// schedule a task to clear the EPOLLIN as it is not safe to modify it directly
|
|
|
|
loop.execute(new OneTimeTask() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (!config().isAutoRead() && !unsafe.readPending) {
|
|
|
|
// Still no read triggered so clear it now
|
|
|
|
unsafe.clearEpollIn0();
|
|
|
|
}
|
2014-04-10 08:27:27 +02:00
|
|
|
}
|
2014-04-22 10:14:31 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// The EventLoop is not registered atm so just update the flags so the correct value
|
|
|
|
// will be used once the channel is registered
|
|
|
|
flags &= ~readFlag;
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-30 09:38:35 +02:00
|
|
|
private void modifyEvents() throws IOException {
|
2015-01-29 06:49:14 +01:00
|
|
|
if (isOpen() && isRegistered()) {
|
2014-04-11 21:08:26 +02:00
|
|
|
((EpollEventLoop) eventLoop()).modify(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
@Override
|
|
|
|
protected void doRegister() throws Exception {
|
|
|
|
EpollEventLoop loop = (EpollEventLoop) eventLoop();
|
|
|
|
loop.add(this);
|
|
|
|
}
|
|
|
|
|
2015-08-04 02:58:37 +02:00
|
|
|
protected final boolean isInputShutdown0() {
|
|
|
|
return inputShutdown;
|
|
|
|
}
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
@Override
|
|
|
|
protected abstract AbstractEpollUnsafe newUnsafe();
|
|
|
|
|
2014-08-05 14:24:49 +02:00
|
|
|
/**
|
|
|
|
* Returns an off-heap copy of the specified {@link ByteBuf}, and releases the original one.
|
|
|
|
*/
|
|
|
|
protected final ByteBuf newDirectBuffer(ByteBuf buf) {
|
|
|
|
return newDirectBuffer(buf, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an off-heap copy of the specified {@link ByteBuf}, and releases the specified holder.
|
|
|
|
* The caller must ensure that the holder releases the original {@link ByteBuf} when the holder is released by
|
|
|
|
* this method.
|
|
|
|
*/
|
|
|
|
protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf) {
|
|
|
|
final int readableBytes = buf.readableBytes();
|
|
|
|
if (readableBytes == 0) {
|
|
|
|
ReferenceCountUtil.safeRelease(holder);
|
|
|
|
return Unpooled.EMPTY_BUFFER;
|
|
|
|
}
|
|
|
|
|
|
|
|
final ByteBufAllocator alloc = alloc();
|
|
|
|
if (alloc.isDirectBufferPooled()) {
|
|
|
|
return newDirectBuffer0(holder, buf, alloc, readableBytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
|
|
|
|
if (directBuf == null) {
|
|
|
|
return newDirectBuffer0(holder, buf, alloc, readableBytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
|
|
|
|
ReferenceCountUtil.safeRelease(holder);
|
|
|
|
return directBuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) {
|
|
|
|
final ByteBuf directBuf = alloc.directBuffer(capacity);
|
|
|
|
directBuf.writeBytes(buf, buf.readerIndex(), capacity);
|
|
|
|
ReferenceCountUtil.safeRelease(holder);
|
|
|
|
return directBuf;
|
|
|
|
}
|
|
|
|
|
2014-03-16 16:29:45 +01:00
|
|
|
protected static void checkResolvable(InetSocketAddress addr) {
|
2014-03-16 14:25:52 +01:00
|
|
|
if (addr.isUnresolved()) {
|
2014-03-16 16:29:45 +01:00
|
|
|
throw new UnresolvedAddressException();
|
2014-03-16 14:25:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-14 16:38:46 +01:00
|
|
|
/**
|
|
|
|
* 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;
|
2015-06-05 03:36:55 +02:00
|
|
|
unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes());
|
2015-01-14 16:38:46 +01:00
|
|
|
if (byteBuf.hasMemoryAddress()) {
|
2015-01-15 14:38:14 +01:00
|
|
|
localReadAmount = Native.readAddress(
|
|
|
|
fileDescriptor.intValue(), byteBuf.memoryAddress(), writerIndex, byteBuf.capacity());
|
2015-01-14 16:38:46 +01:00
|
|
|
} else {
|
|
|
|
ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes());
|
2015-01-15 14:38:14 +01:00
|
|
|
localReadAmount = Native.read(fileDescriptor.intValue(), buf, buf.position(), buf.limit());
|
2015-01-14 16:38:46 +01:00
|
|
|
}
|
|
|
|
if (localReadAmount > 0) {
|
|
|
|
byteBuf.writerIndex(writerIndex + localReadAmount);
|
|
|
|
}
|
|
|
|
return localReadAmount;
|
|
|
|
}
|
|
|
|
|
2015-02-06 16:29:15 +01:00
|
|
|
protected final int doWriteBytes(ByteBuf buf, int writeSpinCount) throws Exception {
|
2015-01-14 16:38:46 +01:00
|
|
|
int readableBytes = buf.readableBytes();
|
|
|
|
int writtenBytes = 0;
|
|
|
|
if (buf.hasMemoryAddress()) {
|
|
|
|
long memoryAddress = buf.memoryAddress();
|
|
|
|
int readerIndex = buf.readerIndex();
|
|
|
|
int writerIndex = buf.writerIndex();
|
2015-02-06 16:29:15 +01:00
|
|
|
for (int i = writeSpinCount - 1; i >= 0; i--) {
|
2015-01-15 14:38:14 +01:00
|
|
|
int localFlushedAmount = Native.writeAddress(
|
|
|
|
fileDescriptor.intValue(), memoryAddress, readerIndex, writerIndex);
|
2015-01-14 16:38:46 +01:00
|
|
|
if (localFlushedAmount > 0) {
|
|
|
|
writtenBytes += localFlushedAmount;
|
|
|
|
if (writtenBytes == readableBytes) {
|
|
|
|
return writtenBytes;
|
|
|
|
}
|
|
|
|
readerIndex += localFlushedAmount;
|
|
|
|
} else {
|
2015-02-06 16:29:15 +01:00
|
|
|
break;
|
2015-01-14 16:38:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ByteBuffer nioBuf;
|
|
|
|
if (buf.nioBufferCount() == 1) {
|
|
|
|
nioBuf = buf.internalNioBuffer(buf.readerIndex(), buf.readableBytes());
|
|
|
|
} else {
|
|
|
|
nioBuf = buf.nioBuffer();
|
|
|
|
}
|
2015-02-06 16:29:15 +01:00
|
|
|
for (int i = writeSpinCount - 1; i >= 0; i--) {
|
2015-01-14 16:38:46 +01:00
|
|
|
int pos = nioBuf.position();
|
|
|
|
int limit = nioBuf.limit();
|
2015-01-15 14:38:14 +01:00
|
|
|
int localFlushedAmount = Native.write(fileDescriptor.intValue(), nioBuf, pos, limit);
|
2015-01-14 16:38:46 +01:00
|
|
|
if (localFlushedAmount > 0) {
|
|
|
|
nioBuf.position(pos + localFlushedAmount);
|
|
|
|
writtenBytes += localFlushedAmount;
|
|
|
|
if (writtenBytes == readableBytes) {
|
|
|
|
return writtenBytes;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-02-06 16:29:15 +01:00
|
|
|
if (writtenBytes < readableBytes) {
|
|
|
|
// Returned EAGAIN need to set EPOLLOUT
|
|
|
|
setFlag(Native.EPOLLOUT);
|
|
|
|
}
|
|
|
|
return writtenBytes;
|
2015-01-14 16:38:46 +01:00
|
|
|
}
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
protected abstract class AbstractEpollUnsafe extends AbstractUnsafe {
|
2014-02-21 21:42:13 +01:00
|
|
|
protected boolean readPending;
|
2015-06-05 03:36:55 +02:00
|
|
|
private EpollRecvByteAllocatorHandle allocHandle;
|
2014-02-15 22:26:36 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once EPOLLIN event is ready to be processed
|
|
|
|
*/
|
|
|
|
abstract void epollInReady();
|
|
|
|
|
2015-08-15 01:36:48 +02:00
|
|
|
/**
|
|
|
|
* Will schedule a {@link #epollInReady()} call on the event loop if necessary.
|
|
|
|
* @param edgeTriggered {@code true} if the channel is using ET mode. {@code false} otherwise.
|
|
|
|
*/
|
|
|
|
final void checkResetEpollIn(boolean edgeTriggered) {
|
|
|
|
if (edgeTriggered && !isInputShutdown0()) {
|
|
|
|
// trigger a read again as there may be something left to read and because of epoll ET we
|
|
|
|
// will not get notified again until we read everything from the socket
|
|
|
|
eventLoop().execute(new OneTimeTask() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
epollInReady();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
/**
|
|
|
|
* Called once EPOLLRDHUP event is ready to be processed
|
|
|
|
*/
|
2015-08-04 02:58:37 +02:00
|
|
|
final void epollRdHupReady() {
|
|
|
|
if (isActive()) {
|
|
|
|
// If it is still active, we need to call epollInReady as otherwise we may miss to
|
|
|
|
// read pending data from the underlying file descriptor.
|
|
|
|
// See https://github.com/netty/netty/issues/3709
|
|
|
|
epollInReady();
|
|
|
|
|
|
|
|
// Clear the EPOLLRDHUP flag to prevent continuously getting woken up on this event.
|
|
|
|
clearEpollRdHup();
|
|
|
|
}
|
|
|
|
// epollInReady may call this, but we should ensure that it gets called.
|
|
|
|
shutdownInput();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the {@link Native#EPOLLRDHUP} flag from EPOLL, and close on failure.
|
|
|
|
*/
|
|
|
|
private void clearEpollRdHup() {
|
|
|
|
try {
|
|
|
|
clearFlag(Native.EPOLLRDHUP);
|
|
|
|
} catch (IOException e) {
|
|
|
|
pipeline().fireExceptionCaught(e);
|
|
|
|
close(voidPromise());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shutdown the input side of the channel.
|
|
|
|
*/
|
|
|
|
void shutdownInput() {
|
|
|
|
if (!inputShutdown) { // Best effort check on volatile variable to prevent multiple shutdowns
|
|
|
|
inputShutdown = true;
|
|
|
|
if (isOpen()) {
|
|
|
|
if (Boolean.TRUE.equals(config().getOption(ChannelOption.ALLOW_HALF_CLOSURE))) {
|
|
|
|
clearEpollIn0();
|
|
|
|
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
|
|
|
} else {
|
|
|
|
close(voidPromise());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
|
2015-06-05 03:36:55 +02:00
|
|
|
@Override
|
|
|
|
public EpollRecvByteAllocatorHandle recvBufAllocHandle() {
|
|
|
|
if (allocHandle == null) {
|
|
|
|
allocHandle = newEpollHandle(super.recvBufAllocHandle());
|
|
|
|
}
|
|
|
|
return allocHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new {@EpollRecvByteAllocatorHandle} instance.
|
|
|
|
* @param handle The handle to wrap with EPOLL specific logic.
|
|
|
|
*/
|
|
|
|
protected abstract EpollRecvByteAllocatorHandle newEpollHandle(RecvByteBufAllocator.Handle handle);
|
|
|
|
|
2014-02-15 22:26:36 +01:00
|
|
|
@Override
|
|
|
|
protected void flush0() {
|
|
|
|
// Flush immediately only when there's no pending flush.
|
|
|
|
// If there's a pending flush operation, event loop will call forceFlush() later,
|
|
|
|
// and thus there's no need to call it now.
|
2015-01-29 06:49:14 +01:00
|
|
|
if (isFlagSet(Native.EPOLLOUT)) {
|
2014-02-15 22:26:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.flush0();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once a EPOLLOUT event is ready to be processed
|
|
|
|
*/
|
|
|
|
void epollOutReady() {
|
|
|
|
// directly call super.flush0() to force a flush now
|
|
|
|
super.flush0();
|
|
|
|
}
|
|
|
|
|
2014-04-10 08:27:27 +02:00
|
|
|
protected final void clearEpollIn0() {
|
2015-04-30 09:38:35 +02:00
|
|
|
assert eventLoop().inEventLoop();
|
|
|
|
try {
|
|
|
|
clearFlag(readFlag);
|
|
|
|
} catch (IOException e) {
|
|
|
|
// When this happens there is something completely wrong with either the filedescriptor or epoll,
|
|
|
|
// so fire the exception through the pipeline and close the Channel.
|
|
|
|
pipeline().fireExceptionCaught(e);
|
|
|
|
unsafe().close(unsafe().voidPromise());
|
|
|
|
}
|
2014-04-10 08:27:27 +02:00
|
|
|
}
|
2014-02-15 22:26:36 +01:00
|
|
|
}
|
|
|
|
}
|