Skip to content

Commit

Permalink
Revert "core: fix boq conformance failures (grpc#8281)"
Browse files Browse the repository at this point in the history
This reverts commit c1ad5de.
  • Loading branch information
YifeiZhuang committed Jun 25, 2021
1 parent c1ad5de commit 72ae12b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 8 additions & 2 deletions core/src/main/java/io/grpc/internal/ServerImpl.java
Expand Up @@ -28,7 +28,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Attributes;
Expand All @@ -54,6 +53,7 @@
import io.grpc.ServerServiceDefinition;
import io.grpc.ServerTransportFilter;
import io.grpc.Status;
import io.grpc.StatusException;
import io.perfmark.Link;
import io.perfmark.PerfMark;
import io.perfmark.Tag;
Expand Down Expand Up @@ -606,11 +606,17 @@ public void runInContext() {

private void runInternal() {
ServerStreamListener listener = NOOP_LISTENER;
ServerCallParameters<?,?> callParameters;
try {
if (future.isCancelled()) {
return;
}
listener = startWrappedCall(methodName, Futures.getDone(future), headers);
if (!future.isDone() || (callParameters = future.get()) == null) {
Status status = Status.INTERNAL.withDescription(
"Unexpected failure retrieving server call parameters.");
throw new StatusException(status);
}
listener = startWrappedCall(methodName, callParameters, headers);
} catch (Throwable ex) {
stream.close(Status.fromThrowable(ex), new Metadata());
context.cancel(null);
Expand Down
5 changes: 1 addition & 4 deletions core/src/test/java/io/grpc/internal/ServerImplTest.java
Expand Up @@ -74,7 +74,6 @@
import io.grpc.ServerTransportFilter;
import io.grpc.ServiceDescriptor;
import io.grpc.Status;
import io.grpc.Status.Code;
import io.grpc.StringMarshaller;
import io.grpc.internal.ServerImpl.JumpToApplicationThreadServerStreamListener;
import io.grpc.internal.ServerImplBuilder.ClientTransportServersBuilder;
Expand Down Expand Up @@ -534,7 +533,6 @@ public ServerCall.Listener<String> startCall(
}

@Test
@SuppressWarnings("CheckReturnValue")
public void executorSupplierFutureNotSet() throws Exception {
builder.executorSupplier = new ServerCallExecutorSupplier() {
@Override
Expand Down Expand Up @@ -577,8 +575,7 @@ public ServerCall.Listener<String> startCall(
assertThat(callReference.get()).isNull();
verify(stream, times(2)).close(statusCaptor.capture(), any(Metadata.class));
Status status = statusCaptor.getAllValues().get(1);
assertEquals(Code.UNKNOWN, status.getCode());
assertThat(status.getCause() instanceof IllegalStateException);
assertEquals(Status.Code.INTERNAL, status.getCode());
}

@Test
Expand Down

0 comments on commit 72ae12b

Please sign in to comment.