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:
parent
d8c0bf3be2
commit
9319e3ebd0
@ -64,6 +64,7 @@ public class SocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
|
|||||||
assertTrue(h.ch.isInputShutdown());
|
assertTrue(h.ch.isInputShutdown());
|
||||||
assertFalse(h.ch.isOutputShutdown());
|
assertFalse(h.ch.isOutputShutdown());
|
||||||
assertEquals(1, h.closure.getCount());
|
assertEquals(1, h.closure.getCount());
|
||||||
|
Thread.sleep(100);
|
||||||
assertEquals(1, h.halfClosureCount.intValue());
|
assertEquals(1, h.halfClosureCount.intValue());
|
||||||
} finally {
|
} finally {
|
||||||
s.close();
|
s.close();
|
||||||
@ -101,6 +102,7 @@ public class SocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
|
|||||||
assertTrue(h.ch.isOutputShutdown());
|
assertTrue(h.ch.isOutputShutdown());
|
||||||
|
|
||||||
assertEquals(1, h.halfClosure.getCount());
|
assertEquals(1, h.halfClosure.getCount());
|
||||||
|
Thread.sleep(100);
|
||||||
assertEquals(0, h.halfClosureCount.intValue());
|
assertEquals(0, h.halfClosureCount.intValue());
|
||||||
} finally {
|
} finally {
|
||||||
s.close();
|
s.close();
|
||||||
|
@ -119,6 +119,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
setInputShutdown();
|
setInputShutdown();
|
||||||
if (isOpen()) {
|
if (isOpen()) {
|
||||||
if (Boolean.TRUE.equals(config().getOption(ChannelOption.ALLOW_HALF_CLOSURE))) {
|
if (Boolean.TRUE.equals(config().getOption(ChannelOption.ALLOW_HALF_CLOSURE))) {
|
||||||
|
key.interestOps(key.interestOps() & ~readInterestOp);
|
||||||
pipeline.fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
pipeline.fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
||||||
} else {
|
} else {
|
||||||
close(voidFuture());
|
close(voidFuture());
|
||||||
|
Loading…
Reference in New Issue
Block a user