Fixed NPE in OioWorker.write when the socket is closed already

This commit is contained in:
Trustin Lee 2009-06-25 09:18:14 +00:00
parent cfa4e5e4ee
commit fb8cc156f3

View File

@ -117,7 +117,15 @@ class OioWorker implements Runnable {
static void write( static void write(
OioSocketChannel channel, ChannelFuture future, OioSocketChannel channel, ChannelFuture future,
Object message) { Object message) {
OutputStream out = channel.getOutputStream(); OutputStream out = channel.getOutputStream();
if (out == null) {
Exception e = new ClosedChannelException();
future.setFailure(e);
fireExceptionCaught(channel, e);
return;
}
try { try {
ChannelBuffer a = (ChannelBuffer) message; ChannelBuffer a = (ChannelBuffer) message;
int bytes = a.readableBytes(); int bytes = a.readableBytes();