diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java index 8494e7073b..f5de0e1ddd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java @@ -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); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index 94466628ea..13528fa3a3 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -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; } } }