Skip to content

Commit

Permalink
remote/http: properly complete user promise
Browse files Browse the repository at this point in the history
Fixes bazelbuild#4976, bazelbuild#4935

Closes bazelbuild#4991.

PiperOrigin-RevId: 192269206
  • Loading branch information
buchgr authored and Copybara-Service committed Apr 10, 2018
1 parent f1f5f99 commit 04ce86e
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ protected String constructHost(URI uri) {
}

@Override
public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) {
failAndResetUserPromise(throwable);
public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
failAndResetUserPromise(t);
ctx.fireExceptionCaught(t);
}

@SuppressWarnings("FutureReturnValueIgnored")
Expand Down Expand Up @@ -131,6 +132,7 @@ public void close(ChannelHandlerContext ctx, ChannelPromise promise) {
@SuppressWarnings("FutureReturnValueIgnored")
@Override
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) {
failAndResetUserPromise(new ClosedChannelException());
ctx.deregister(promise);
}

Expand All @@ -147,8 +149,19 @@ public void flush(ChannelHandlerContext ctx) {
}

@Override
public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
public void channelInactive(ChannelHandlerContext ctx) {
failAndResetUserPromise(new ClosedChannelException());
ctx.fireChannelInactive();
}

@Override
public void handlerRemoved(ChannelHandlerContext ctx) {
failAndResetUserPromise(new IOException("handler removed"));
}

@Override
public void channelUnregistered(ChannelHandlerContext ctx) {
failAndResetUserPromise(new ClosedChannelException());
super.channelInactive(channelHandlerContext);
ctx.fireChannelUnregistered();
}
}

0 comments on commit 04ce86e

Please sign in to comment.