mirror of https://github.com/grpc/grpc-java.git
Fix workaround in place for GFE's lack of trailers.
A recent refactoring moved code so our previous workaround stopped producing any effect. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=79965647
This commit is contained in:
parent
0f56c47ac8
commit
01152e093d
|
|
@ -186,14 +186,6 @@ public abstract class AbstractClientStream<IdT> extends AbstractStream<IdT>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void remoteEndClosed() {
|
protected void remoteEndClosed() {
|
||||||
// TODO(user): Delete this hack when trailers are supported by GFE with v2. Currently GFE
|
|
||||||
// doesn't support trailers, so when using gRPC v2 protocol GFE will not send any status. We
|
|
||||||
// paper over this for now by just assuming OK. For all properly functioning servers (both v1
|
|
||||||
// and v2), stashedStatus should not be null here.
|
|
||||||
if (stashedStatus == null) {
|
|
||||||
stashedStatus = Status.OK;
|
|
||||||
stashedTrailers = new Metadata.Trailers();
|
|
||||||
}
|
|
||||||
Preconditions.checkState(stashedStatus != null, "Status and trailers should have been set");
|
Preconditions.checkState(stashedStatus != null, "Status and trailers should have been set");
|
||||||
setStatus(stashedStatus, stashedTrailers);
|
setStatus(stashedStatus, stashedTrailers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,20 @@ public abstract class Http2ClientStream extends AbstractClientStream<Integer> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (endOfStream && GRPC_V2_PROTOCOL) {
|
if (endOfStream && GRPC_V2_PROTOCOL) {
|
||||||
// This is a protocol violation as we expect to receive trailers.
|
if (false) {
|
||||||
transportError = Status.INTERNAL.withDescription("Recevied EOS on DATA frame");
|
// This is a protocol violation as we expect to receive trailers.
|
||||||
frame.close();
|
transportError = Status.INTERNAL.withDescription("Recevied EOS on DATA frame");
|
||||||
inboundTransportError(transportError);
|
frame.close();
|
||||||
|
inboundTransportError(transportError);
|
||||||
|
} else {
|
||||||
|
// TODO(user): Delete this hack when trailers are supported by GFE with v2. Currently GFE
|
||||||
|
// doesn't support trailers, so when using gRPC v2 protocol GFE will not send any status.
|
||||||
|
// We paper over this for now by just assuming OK. For all properly functioning servers
|
||||||
|
// (both v1 and v2), stashedStatus should not be null here.
|
||||||
|
Metadata.Trailers trailers = new Metadata.Trailers();
|
||||||
|
trailers.put(Status.CODE_KEY, Status.OK);
|
||||||
|
inboundTrailersReceived(trailers, Status.OK);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
inboundDataReceived(frame);
|
inboundDataReceived(frame);
|
||||||
if (endOfStream && !GRPC_V2_PROTOCOL) {
|
if (endOfStream && !GRPC_V2_PROTOCOL) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue