Fix race in ChannelReadHandler used during LocalChannel testing. (#7904)

Motivation:

ChannelReadHandler is used in tests added via f4d7e8de14. In the handler we verify the number of messages we receive per read() call but missed to sometimes reset the counter which resulted in exceptions.

Modifications:

Correctly reset read counter in all cases.

Result:

No more unexpected exceptions when running LocalChannel tests.
This commit is contained in:
Norman Maurer 2018-05-04 07:36:33 +02:00 committed by GitHub
parent c60263e8a3
commit 095dadcbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1190,8 +1190,16 @@ public class LocalChannelTest {
} else { } else {
read = 0; read = 0;
} }
} else {
read = 0;
} }
ctx.fireChannelReadComplete(); ctx.fireChannelReadComplete();
} }
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
ctx.fireExceptionCaught(cause);
ctx.close();
}
} }
} }