Fixed an infinite loop on a certain NIO impl

This commit is contained in:
Trustin Lee 2011-03-25 02:27:20 +09:00
parent 6707aa751c
commit f3899e8d58
3 changed files with 3 additions and 0 deletions

View File

@ -391,6 +391,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
} catch (Throwable t) { } catch (Throwable t) {
ch.connectFuture.setFailure(t); ch.connectFuture.setFailure(t);
fireExceptionCaught(ch, t); fireExceptionCaught(ch, t);
k.cancel(); // Some JDK implementations run into an infinite loop without this.
ch.worker.close(ch, succeededFuture(ch)); ch.worker.close(ch, succeededFuture(ch));
} }
} }

View File

@ -424,6 +424,7 @@ class NioDatagramWorker implements Runnable {
} }
if (failure) { if (failure) {
key.cancel(); // Some JDK implementations run into an infinite loop without this.
close(channel, succeededFuture(channel)); close(channel, succeededFuture(channel));
return false; return false;
} }

View File

@ -353,6 +353,7 @@ class NioWorker implements Runnable {
} }
if (ret < 0 || failure) { if (ret < 0 || failure) {
k.cancel(); // Some JDK implementations run into an infinite loop without this.
close(channel, succeededFuture(channel)); close(channel, succeededFuture(channel));
return false; return false;
} }