Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f8739e1 authored by Jack He's avatar Jack He
Browse files

GRPC: Use server_stream_call.cancelled() instead of hidden API

* Use server_stream_call.cancelled() to check if a stream
  is cancelled to avoid calling hidden APIs

Test: run cert tests multiple times
Bug: 148147248
Change-Id: Iea352d4b428b9b57b911576a44f7a91842613fc7
parent 3e46a0f4
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

from concurrent.futures import ThreadPoolExecutor
from grpc import RpcError
from grpc._channel import _Rendezvous
import logging


@@ -140,10 +139,9 @@ class EventCallbackStream(object):
                        callback(event)
            return None
        except RpcError as exp:
            if type(exp) is _Rendezvous:
                if exp.cancelled():
            if self.server_stream_call.cancelled():
                logging.debug("Cancelled")
                return None
            else:
                    logging.warning("Not cancelled")
                logging.warning("Some RPC error not due to cancellation")
            return exp