Correctly handle remove from epoll and EPOLLRDHUP. Also fix a bug with removing EPOLLIN and EPOLLOUT
This commit is contained in:
parent
23374a1854
commit
eb143d6d6e
@ -65,6 +65,10 @@ abstract class AbstractEpollChannel extends AbstractChannel {
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
active = false;
|
||||
|
||||
// deregister from epoll now
|
||||
doDeregister();
|
||||
|
||||
int fd = this.fd;
|
||||
this.fd = -1;
|
||||
Native.close(fd);
|
||||
@ -110,7 +114,7 @@ abstract class AbstractEpollChannel extends AbstractChannel {
|
||||
|
||||
protected final void clearEpollIn() {
|
||||
if ((flags & readFlag) != 0) {
|
||||
flags = ~readFlag;
|
||||
flags &= ~readFlag;
|
||||
((EpollEventLoop) eventLoop()).modify(this);
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
||||
|
||||
private void clearEpollOut() {
|
||||
if ((flags & Native.EPOLLOUT) != 0) {
|
||||
flags = ~Native.EPOLLOUT;
|
||||
flags &= ~Native.EPOLLOUT;
|
||||
((EpollEventLoop) eventLoop()).modify(this);
|
||||
}
|
||||
}
|
||||
@ -528,7 +528,11 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
||||
|
||||
@Override
|
||||
void epollRdHupReady() {
|
||||
closeOnRead(pipeline());
|
||||
if (isActive()) {
|
||||
epollInReady();
|
||||
} else {
|
||||
closeOnRead(pipeline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user