Made sure NioWorker.cleanUpWriteBuffer() is called even if the worker thread is not running.

This commit is contained in:
Trustin Lee 2008-11-07 02:00:07 +00:00
parent b50cc2b025
commit 3a2a7a3a3c

View File

@ -378,6 +378,11 @@ class NioWorker implements Runnable {
}
static void write(final NioSocketChannel channel, boolean mightNeedWakeup) {
if (!channel.isConnected()) {
cleanUpWriteBuffer(channel);
return;
}
if (mightNeedWakeup) {
NioWorker worker = channel.getWorker();
if (worker != null) {
@ -397,11 +402,6 @@ class NioWorker implements Runnable {
}
}
if (!channel.isConnected()) {
cleanUpWriteBuffer(channel);
return;
}
final NioSocketChannelConfig cfg = channel.getConfig();
final int writeSpinCount = cfg.getWriteSpinCount();
final int maxWrittenBytes;