netty: fix server keepalive unexpected ping ack

Resolves #3684
This commit is contained in:
ZHANG Dapeng 2017-11-14 11:09:31 -08:00 committed by GitHub
parent de06a9471a
commit 66f9ef5d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -774,7 +774,8 @@ class NettyServerHandler extends AbstractNettyHandler {
@Override
public void ping() {
ChannelFuture pingFuture = encoder().writePing(
ctx, false /* isAck */, KEEPALIVE_PING_BUF, ctx.newPromise());
// slice KEEPALIVE_PING_BUF because tls handler may modify the reader index
ctx, false /* isAck */, KEEPALIVE_PING_BUF.slice(), ctx.newPromise());
ctx.flush();
if (transportTracer != null) {
pingFuture.addListener(new ChannelFutureListener() {