diff --git a/runtime/src/main/java/org/capnproto/Capability.java b/runtime/src/main/java/org/capnproto/Capability.java index 5abe634..8115b71 100644 --- a/runtime/src/main/java/org/capnproto/Capability.java +++ b/runtime/src/main/java/org/capnproto/Capability.java @@ -759,7 +759,12 @@ public final class Capability { @Override public Request newCall(long interfaceId, short methodId) { var hook = new LocalRequest(interfaceId, methodId, this); - this.pendingCalls.add(hook); + if (this.redirect == null) { + this.pendingCalls.add(hook); + } + else { + hook.releaseCall(); + } var root = hook.message.getRoot(AnyPointer.factory); return newTypelessRequest(root, hook); } @@ -767,7 +772,12 @@ public final class Capability { @Override public VoidPromiseAndPipeline call(long interfaceId, short methodId, CallContextHook ctx) { var promise = new CompletableFuture(); - this.queuedCalls.add(promise); + if (this.redirect == null) { + this.queuedCalls.add(promise); + } + else { + promise.complete(this.redirect); + } var callResult = promise.thenApply( client -> client.call(interfaceId, methodId, ctx));