diff --git a/src/python/src/grpc/_adapter/rear.py b/src/python/src/grpc/_adapter/rear.py index 38936ed7ae8..eee008e4dfa 100644 --- a/src/python/src/grpc/_adapter/rear.py +++ b/src/python/src/grpc/_adapter/rear.py @@ -191,8 +191,7 @@ class RearLink(ticket_interfaces.RearLink, activated.Activated): if event.status.code is _low.Code.OK: kind = tickets.BackToFrontPacket.Kind.COMPLETION elif event.status.code is _low.Code.CANCELLED: - # TODO(issue 752): Use a CANCELLATION ticket kind here. - kind = tickets.BackToFrontPacket.Kind.SERVICER_FAILURE + kind = tickets.BackToFrontPacket.Kind.CANCELLATION elif event.status.code is _low.Code.EXPIRED: kind = tickets.BackToFrontPacket.Kind.EXPIRATION else: diff --git a/src/python/src/grpc/framework/base/packets/_reception.py b/src/python/src/grpc/framework/base/packets/_reception.py index 697095961ae..ef10c7f8fe5 100644 --- a/src/python/src/grpc/framework/base/packets/_reception.py +++ b/src/python/src/grpc/framework/base/packets/_reception.py @@ -244,7 +244,9 @@ class _FrontReceiver(_Receiver): A base_interfaces.Outcome value describing operation abortion if the packet is abortive or None if the packet is not abortive. """ - if packet.kind is packets.BackToFrontPacket.Kind.EXPIRATION: + if packet.kind is packets.BackToFrontPacket.Kind.CANCELLATION: + return base_interfaces.Outcome.CANCELLED + elif packet.kind is packets.BackToFrontPacket.Kind.EXPIRATION: return base_interfaces.Outcome.EXPIRED elif packet.kind is packets.BackToFrontPacket.Kind.SERVICER_FAILURE: return base_interfaces.Outcome.SERVICER_FAILURE diff --git a/src/python/src/grpc/framework/base/packets/_transmission.py b/src/python/src/grpc/framework/base/packets/_transmission.py index 9922213d0aa..1b18204ec51 100644 --- a/src/python/src/grpc/framework/base/packets/_transmission.py +++ b/src/python/src/grpc/framework/base/packets/_transmission.py @@ -63,6 +63,8 @@ _ABORTION_OUTCOME_TO_FRONT_TO_BACK_PACKET_KIND = { } _ABORTION_OUTCOME_TO_BACK_TO_FRONT_PACKET_KIND = { + interfaces.Outcome.CANCELLED: + packets.BackToFrontPacket.Kind.CANCELLATION, interfaces.Outcome.EXPIRED: packets.BackToFrontPacket.Kind.EXPIRATION, interfaces.Outcome.RECEPTION_FAILURE: diff --git a/src/python/src/grpc/framework/base/packets/packets.py b/src/python/src/grpc/framework/base/packets/packets.py index d3f9a92aa07..1b140481f0e 100644 --- a/src/python/src/grpc/framework/base/packets/packets.py +++ b/src/python/src/grpc/framework/base/packets/packets.py @@ -108,9 +108,9 @@ class BackToFrontPacket( class Kind(enum.Enum): """Identifies the overall kind of a BackToFrontPacket.""" - # TODO(issue 752): Add CANCELLATION. CONTINUATION = 'continuation' COMPLETION = 'completion' + CANCELLATION = 'cancellation' EXPIRATION = 'expiration' SERVICER_FAILURE = 'servicer failure' SERVICED_FAILURE = 'serviced failure'