NETTY-410 NioWorker write deadlock

Applied the patch provided by Greg Dhuse.
This commit is contained in:
Trustin Lee 2011-08-01 01:32:55 +09:00
parent 8982838ab2
commit 2acd74db83

View File

@ -506,17 +506,23 @@ class NioWorker implements Runnable {
} }
} }
channel.inWriteNowLoop = false; channel.inWriteNowLoop = false;
// 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 (open) {
if (addOpWrite) {
setOpWrite(channel);
} else if (removeOpWrite) {
clearOpWrite(channel);
}
}
} }
fireWriteComplete(channel, writtenBytes); fireWriteComplete(channel, writtenBytes);
if (open) {
if (addOpWrite) {
setOpWrite(channel);
} else if (removeOpWrite) {
clearOpWrite(channel);
}
}
} }
private void setOpWrite(NioSocketChannel channel) { private void setOpWrite(NioSocketChannel channel) {