Skip to content

Commit 61b6fec

Browse files
committed
xds: set end_of_stream on client half-close and handle end_of_stream_without_message per ext_proc spec
1 parent 6505b99 commit 61b6fec

2 files changed

Lines changed: 544 additions & 7 deletions

File tree

‎xds/src/main/java/io/grpc/xds/ExternalProcessorClientInterceptor.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ public void halfClose() {
886886
// Mode is GRPC
887887
sendToExtProc(ProcessingRequest.newBuilder()
888888
.setRequestBody(HttpBody.newBuilder()
889+
.setEndOfStream(true)
889890
.setEndOfStreamWithoutMessage(true)
890891
.build())
891892
.build());
@@ -916,10 +917,13 @@ private void handleRequestBodyResponse(BodyResponse bodyResponse) {
916917
BodyMutation mutation = bodyResponse.getResponse().getBodyMutation();
917918
if (mutation.hasStreamedResponse()) {
918919
StreamedBodyResponse streamed = mutation.getStreamedResponse();
919-
if (!streamed.getEndOfStreamWithoutMessage()) {
920+
boolean isEndOfStream = streamed.getEndOfStream();
921+
boolean isEndOfStreamWithoutMessage =
922+
isEndOfStream && streamed.getEndOfStreamWithoutMessage();
923+
if (!isEndOfStreamWithoutMessage) {
920924
super.sendMessage(new KnownLengthInputStream(streamed.getBody()));
921925
}
922-
if (streamed.getEndOfStream() || streamed.getEndOfStreamWithoutMessage()) {
926+
if (isEndOfStream) {
923927
if (requestSideClosed.compareAndSet(false, true)) {
924928
proceedWithHalfClose();
925929
}

0 commit comments

Comments
 (0)