@@ -1332,7 +1332,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
1332
1332
p .onClose (ctx , e );
1333
1333
1334
1334
if (future != null && !future .isDone () && !future .isCancelled ()) {
1335
- if (! remotelyClosed (ctx .getChannel (), future )) {
1335
+ if (remotelyClosed (ctx .getChannel (), future )) {
1336
1336
abort (future , new IOException ("Remotely Closed" ));
1337
1337
}
1338
1338
} else {
@@ -1344,18 +1344,20 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
1344
1344
protected boolean remotelyClosed (Channel channel , NettyResponseFuture <?> future ) {
1345
1345
1346
1346
if (isClose .get ()) {
1347
- return false ;
1347
+ return true ;
1348
1348
}
1349
1349
1350
1350
connectionsPool .removeAll (channel );
1351
1351
1352
- if (future == null && channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment () instanceof NettyResponseFuture ) {
1353
- future = (NettyResponseFuture <?>) channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment ();
1352
+ if (future == null ) {
1353
+ Object attachment = channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment ();
1354
+ if (attachment instanceof NettyResponseFuture )
1355
+ future = (NettyResponseFuture <?>) attachment ;
1354
1356
}
1355
1357
1356
1358
if (future == null || future .cannotBeReplay ()) {
1357
1359
log .debug ("Unable to recover future {}\n " , future );
1358
- return false ;
1360
+ return true ;
1359
1361
}
1360
1362
1361
1363
future .setState (NettyResponseFuture .STATE .RECONNECTED );
@@ -1365,13 +1367,13 @@ protected boolean remotelyClosed(Channel channel, NettyResponseFuture<?> future)
1365
1367
1366
1368
try {
1367
1369
nextRequest (future .getRequest (), future );
1368
- return true ;
1370
+ return false ;
1369
1371
} catch (IOException iox ) {
1370
1372
future .setState (NettyResponseFuture .STATE .CLOSED );
1371
1373
future .abort (iox );
1372
1374
log .error ("Remotely Closed, unable to recover" , iox );
1373
1375
}
1374
- return false ;
1376
+ return true ;
1375
1377
}
1376
1378
1377
1379
private void markAsDone (final NettyResponseFuture <?> future , final ChannelHandlerContext ctx ) throws MalformedURLException {
0 commit comments