Fixed a bug where AsynchronousCloseException causes IndexOutOfBoundsException during write

This commit is contained in:
Trustin Lee 2009-09-01 08:41:36 +00:00
parent 94a1633ec9
commit e0bef12e2c
2 changed files with 6 additions and 0 deletions

View File

@ -539,7 +539,9 @@ class NioDatagramWorker implements Runnable {
}
} catch (final AsynchronousCloseException e) {
// Doesn't need a user attention - ignore.
channel.currentWriteEvent = evt;
} catch (final Throwable t) {
channel.currentWriteEvent = null;
evt.getFuture().setFailure(t);
evt = null;
fireExceptionCaught(channel, t);

View File

@ -454,13 +454,17 @@ class NioWorker implements Runnable {
}
} catch (AsynchronousCloseException e) {
// Doesn't need a user attention - ignore.
channel.currentWriteEvent = evt;
channel.currentWriteIndex = bufIdx;
} catch (Throwable t) {
channel.currentWriteEvent = null;
evt.getFuture().setFailure(t);
evt = null;
fireExceptionCaught(channel, t);
if (t instanceof IOException) {
open = false;
close(channel, succeededFuture(channel));
break;
}
}
}