Fix SocketShutdownOutputByPeerTest failure

- With half-close enabled, the selector loop was spinning due to uncleared OP_READ flag.
 - Added some delay to the test for more reliable failure
This commit is contained in:
Trustin Lee 2013-02-08 01:50:44 +09:00
parent d8c0bf3be2
commit 9319e3ebd0
2 changed files with 3 additions and 0 deletions

View File

@ -64,6 +64,7 @@ public class SocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
assertTrue(h.ch.isInputShutdown());
assertFalse(h.ch.isOutputShutdown());
assertEquals(1, h.closure.getCount());
Thread.sleep(100);
assertEquals(1, h.halfClosureCount.intValue());
} finally {
s.close();
@ -101,6 +102,7 @@ public class SocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
assertTrue(h.ch.isOutputShutdown());
assertEquals(1, h.halfClosure.getCount());
Thread.sleep(100);
assertEquals(0, h.halfClosureCount.intValue());
} finally {
s.close();

View File

@ -119,6 +119,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
setInputShutdown();
if (isOpen()) {
if (Boolean.TRUE.equals(config().getOption(ChannelOption.ALLOW_HALF_CLOSURE))) {
key.interestOps(key.interestOps() & ~readInterestOp);
pipeline.fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
} else {
close(voidFuture());