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
|
@Override
|
||||||
protected void doClose() throws Exception {
|
protected void doClose() throws Exception {
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
|
// deregister from epoll now
|
||||||
|
doDeregister();
|
||||||
|
|
||||||
int fd = this.fd;
|
int fd = this.fd;
|
||||||
this.fd = -1;
|
this.fd = -1;
|
||||||
Native.close(fd);
|
Native.close(fd);
|
||||||
@ -110,7 +114,7 @@ abstract class AbstractEpollChannel extends AbstractChannel {
|
|||||||
|
|
||||||
protected final void clearEpollIn() {
|
protected final void clearEpollIn() {
|
||||||
if ((flags & readFlag) != 0) {
|
if ((flags & readFlag) != 0) {
|
||||||
flags = ~readFlag;
|
flags &= ~readFlag;
|
||||||
((EpollEventLoop) eventLoop()).modify(this);
|
((EpollEventLoop) eventLoop()).modify(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
|||||||
|
|
||||||
private void clearEpollOut() {
|
private void clearEpollOut() {
|
||||||
if ((flags & Native.EPOLLOUT) != 0) {
|
if ((flags & Native.EPOLLOUT) != 0) {
|
||||||
flags = ~Native.EPOLLOUT;
|
flags &= ~Native.EPOLLOUT;
|
||||||
((EpollEventLoop) eventLoop()).modify(this);
|
((EpollEventLoop) eventLoop()).modify(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,8 +528,12 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void epollRdHupReady() {
|
void epollRdHupReady() {
|
||||||
|
if (isActive()) {
|
||||||
|
epollInReady();
|
||||||
|
} else {
|
||||||
closeOnRead(pipeline());
|
closeOnRead(pipeline());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void epollInReady() {
|
void epollInReady() {
|
||||||
|
Loading…
Reference in New Issue
Block a user