QueuedClient should stop queuing calls once it has resolved

This commit is contained in:
Vaci Koblizek 2020-11-27 15:24:37 +00:00
parent 789d2df6e4
commit ab44843b12

View file

@ -759,7 +759,12 @@ public final class Capability {
@Override
public Request<AnyPointer.Builder> newCall(long interfaceId, short methodId) {
var hook = new LocalRequest(interfaceId, methodId, this);
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<ClientHook>();
if (this.redirect == null) {
this.queuedCalls.add(promise);
}
else {
promise.complete(this.redirect);
}
var callResult = promise.thenApply(
client -> client.call(interfaceId, methodId, ctx));