core: Call onSentBytes only if future is successfull. (#2339)

For example, if opening a stream failed after a DATA frame had already been queued.
This commit is contained in:
Jakob Buchgraber 2016-10-17 19:23:19 +02:00 committed by GitHub
parent 46e46eb8bd
commit 10f4c90f4e
1 changed files with 5 additions and 3 deletions

View File

@ -150,9 +150,11 @@ class NettyClientStream extends AbstractClientStream2 {
channel.newPromise().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
// Remove the bytes from outbound flow control, optionally notifying
// the client that they can send more bytes.
transportState().onSentBytes(numBytes);
if (future.isSuccess()) {
// Remove the bytes from outbound flow control, optionally notifying
// the client that they can send more bytes.
transportState().onSentBytes(numBytes);
}
}
}), flush);
} else {