Skip to content

Commit c766293

Browse files
committed
Fixed the logic for identifying eos when response body send more is on vs off.
1 parent 3b09efd commit c766293

2 files changed

Lines changed: 854 additions & 230 deletions

File tree

xds/src/main/java/io/grpc/xds/ExternalProcessorServerInterceptor.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.common.collect.ImmutableMap;
2929
import com.google.common.io.BaseEncoding;
3030
import com.google.common.io.ByteStreams;
31+
import com.google.common.util.concurrent.MoreExecutors;
3132
import com.google.protobuf.ByteString;
3233
import com.google.protobuf.UnsafeByteOperations;
3334
import com.google.protobuf.Struct;
@@ -134,7 +135,7 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
134135
ScheduledExecutorService scheduler = SharedResourceHolder.get(GrpcUtil.TIMER_SERVICE);
135136
ExternalProcessorGrpc.ExternalProcessorStub extProcStub = ExternalProcessorGrpc.newStub(
136137
cachedChannelManager.getChannel(filterConfig.getGrpcServiceConfig()))
137-
.withExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor());
138+
.withExecutor(MoreExecutors.directExecutor());
138139

139140
if (filterConfig.getGrpcServiceConfig().timeout().isPresent()) {
140141
long timeoutNanos = filterConfig.getGrpcServiceConfig().timeout().get().toNanos();
@@ -350,7 +351,7 @@ protected DataPlaneServerCall(
350351
Context callContext) {
351352
super(rawCall);
352353
this.rawCall = rawCall;
353-
this.delegateExecutor = new SerializingExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor());
354+
this.delegateExecutor = new SerializingExecutor(MoreExecutors.directExecutor());
354355
this.extProcStub = extProcStub.withExecutor(this.delegateExecutor);
355356
this.config = config;
356357
this.currentProcessingMode = config.getExternalProcessor().getProcessingMode();
@@ -1100,7 +1101,10 @@ private void checkEndOfStream(ProcessingResponse response) {
11001101
boolean terminal = false;
11011102
if (response.hasResponseTrailers()) {
11021103
terminal = true;
1103-
} else if (response.hasResponseHeaders() && savedStatus != null) {
1104+
} else if (response.hasResponseHeaders() && savedStatus != null
1105+
&& currentProcessingMode.getResponseBodyMode() == ProcessingMode.BodySendMode.NONE) {
1106+
terminal = true;
1107+
} else if (response.hasResponseBody() && responseSideClosed.get()) {
11041108
terminal = true;
11051109
}
11061110

0 commit comments

Comments
 (0)