private void doClose(ServerStatusAndMetadata statusAndMetadata, @Nullable Throwable exception) {
        maybeLogFailedRequestContent(exception);
        Status status = statusAndMetadata.status();
        final Metadata metadata = statusAndMetadata.metadata();
        if (isCancelled()) {
            // No need to write anything to client if cancelled already.
            statusAndMetadata.shouldCancel(true);
            closeListener(statusAndMetadata);
            return;
        }

        if (status.getCode() == Code.CANCELLED && status.getCause() instanceof ClosedStreamException) {
            statusAndMetadata.shouldCancel(true);
            closeListener(statusAndMetadata);
            return;
        }

        checkState(!closeCalled, "call already closed. status: %s, exception: %s",
                   status, exception);
        closeCalled = true;

        if (status.isOk() && method.getType().serverSendsOneMessage() && firstResponse() == null) {
            // A call that should send a message incompletely finished.
            final String description = "Completed without a response";
            logger.warn("{} {} status: {}, metadata: {}", ctx, description, status, metadata);
            status = Status.CANCELLED.withDescription(description);
            statusAndMetadata = statusAndMetadata.withStatus(status);
            statusAndMetadata.shouldCancel(true);
        }
        doClose(statusAndMetadata);
    }
Cancels a call when the call was closed by a client, not by server.
grpc/src/main/java/com/linecorp/armeria/internal/server/grpc/AbstractServerCall.java