EPOLL Shutdown Input Half Closed

Motivation:
EPOLL attempts to support half closed socket, but fails to call shutdown to close the read portion of the file descriptor.

Motivation:
- If half closed is supported shutting down the input should call underlying Native.shutdown(...) to make sure the peer is notified of the half closed state.

Result:
EPOLL half closed is more correct.
This commit is contained in:
Scott Mitchell 2015-10-06 11:32:44 -07:00
parent 2ff2806ada
commit b2399c2475

View File

@ -377,8 +377,14 @@ abstract class AbstractEpollChannel extends AbstractChannel implements UnixChann
inputShutdown = true;
if (isOpen()) {
if (Boolean.TRUE.equals(config().getOption(ChannelOption.ALLOW_HALF_CLOSURE))) {
clearEpollIn0();
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
try {
Native.shutdown(fd().intValue(), true, false);
clearEpollIn0();
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
} catch (IOException e) {
pipeline().fireExceptionCaught(e);
close(voidPromise());
}
} else {
close(voidPromise());
}