remote/http: properly complete user promise
Fixes #4976, #4935
Closes #4991.
PiperOrigin-RevId: 192269206
diff --git a/src/main/java/com/google/devtools/build/lib/remote/blobstore/http/AbstractHttpHandler.java b/src/main/java/com/google/devtools/build/lib/remote/blobstore/http/AbstractHttpHandler.java
index 0c4c8e2..c9cdd0c 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/blobstore/http/AbstractHttpHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/blobstore/http/AbstractHttpHandler.java
@@ -94,8 +94,9 @@
}
@Override
- public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) {
- failAndResetUserPromise(throwable);
+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
+ failAndResetUserPromise(t);
+ ctx.fireExceptionCaught(t);
}
@SuppressWarnings("FutureReturnValueIgnored")
@@ -131,6 +132,7 @@
@SuppressWarnings("FutureReturnValueIgnored")
@Override
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) {
+ failAndResetUserPromise(new ClosedChannelException());
ctx.deregister(promise);
}
@@ -147,8 +149,19 @@
}
@Override
- public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
+ public void channelInactive(ChannelHandlerContext ctx) {
failAndResetUserPromise(new ClosedChannelException());
- super.channelInactive(channelHandlerContext);
+ ctx.fireChannelInactive();
+ }
+
+ @Override
+ public void handlerRemoved(ChannelHandlerContext ctx) {
+ failAndResetUserPromise(new IOException("handler removed"));
+ }
+
+ @Override
+ public void channelUnregistered(ChannelHandlerContext ctx) {
+ failAndResetUserPromise(new ClosedChannelException());
+ ctx.fireChannelUnregistered();
}
}