@@ -286,7 +286,7 @@ private void doFlush(final ChannelHandlerContext ctx) { |
286 | 286 | ChannelFuture f = ctx.writeAndFlush(message); |
287 | 287 | if (endOfInput) { |
288 | 288 | if (f.isDone()) { |
289 | | - handleEndOfInputFuture(f, currentWrite); |
| 289 | + handleEndOfInputFuture(f, chunks, currentWrite); |
290 | 290 | } else { |
291 | 291 | // Register a listener which will close the input once the write is complete. |
292 | 292 | // This is needed because the Chunk may have some resource bound that can not |
@@ -296,19 +296,19 @@ private void doFlush(final ChannelHandlerContext ctx) { |
296 | 296 | f.addListener(new ChannelFutureListener() { |
297 | 297 | @Override |
298 | 298 | public void operationComplete(ChannelFuture future) { |
299 | | - handleEndOfInputFuture(future, currentWrite); |
| 299 | + handleEndOfInputFuture(future, chunks, currentWrite); |
300 | 300 | } |
301 | 301 | }); |
302 | 302 | } |
303 | 303 | } else { |
304 | 304 | final boolean resume = !channel.isWritable(); |
305 | 305 | if (f.isDone()) { |
306 | | - handleFuture(f, currentWrite, resume); |
| 306 | + handleFuture(f, chunks, currentWrite, resume); |
307 | 307 | } else { |
308 | 308 | f.addListener(new ChannelFutureListener() { |
309 | 309 | @Override |
310 | 310 | public void operationComplete(ChannelFuture future) { |
311 | | - handleFuture(future, currentWrite, resume); |
| 311 | + handleFuture(future, chunks, currentWrite, resume); |
312 | 312 | } |
313 | 313 | }); |
314 | 314 | } |
@@ -331,8 +331,7 @@ public void operationComplete(ChannelFuture future) { |
331 | 331 | } |
332 | 332 | } |
333 | 333 |
|
334 | | - private static void handleEndOfInputFuture(ChannelFuture future, PendingWrite currentWrite) { |
335 | | - ChunkedInput<?> input = (ChunkedInput<?>) currentWrite.msg; |
| 334 | + private static void handleEndOfInputFuture(ChannelFuture future, ChunkedInput<?> input, PendingWrite currentWrite) { |
336 | 335 | if (!future.isSuccess()) { |
337 | 336 | closeInput(input); |
338 | 337 | currentWrite.fail(future.cause()); |
@@ -346,8 +345,7 @@ private static void handleEndOfInputFuture(ChannelFuture future, PendingWrite cu |
346 | 345 | } |
347 | 346 | } |
348 | 347 |
|
349 | | - private void handleFuture(ChannelFuture future, PendingWrite currentWrite, boolean resume) { |
350 | | - ChunkedInput<?> input = (ChunkedInput<?>) currentWrite.msg; |
| 348 | + private void handleFuture(ChannelFuture future, ChunkedInput<?> input, PendingWrite currentWrite, boolean resume) { |
351 | 349 | if (!future.isSuccess()) { |
352 | 350 | closeInput(input); |
353 | 351 | currentWrite.fail(future.cause()); |
|