NETTY-410 NioWorker write deadlock

Applied the patch provided by Greg Dhuse.
This commit is contained in:
Trustin Lee 2011-08-01 04:00:01 +09:00
parent b9ef785b5b
commit 4bf26c31e9

View File

@ -568,10 +568,13 @@ class NioDatagramWorker implements Runnable {
}
}
channel.inWriteNowLoop = false;
}
fireWriteComplete(channel, writtenBytes);
// Initially, the following block was executed after releasing
// the writeLock, but there was a race condition, and it has to be
// executed before releasing the writeLock:
//
// https://issues.jboss.org/browse/NETTY-410
//
if (addOpWrite) {
setOpWrite(channel);
} else if (removeOpWrite) {
@ -579,6 +582,9 @@ class NioDatagramWorker implements Runnable {
}
}
fireWriteComplete(channel, writtenBytes);
}
private void setOpWrite(final NioDatagramChannel channel) {
Selector selector = this.selector;
SelectionKey key = channel.getDatagramChannel().keyFor(selector);