aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio
diff options
context:
space:
mode:
authorGravatar Ken Payson <kpayson@google.com>2016-07-12 08:47:15 -0700
committerGravatar Ken Payson <kpayson@google.com>2016-07-18 16:23:47 -0700
commite39edac2c84f5a5195b09cca4bd9628a90318c12 (patch)
treec9b17f485fee7ea1242bdfe827819bc9ada4e776 /src/python/grpcio
parent7c467547ba988ae56e05b02220143f4ea6930b91 (diff)
Fixed name syntax error
Diffstat (limited to 'src/python/grpcio')
-rw-r--r--src/python/grpcio/grpc/_channel.py4
-rw-r--r--src/python/grpcio/grpc/beta/_client_adaptations.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py
index 29dbc3a668..3117dd1cb3 100644
--- a/src/python/grpcio/grpc/_channel.py
+++ b/src/python/grpcio/grpc/_channel.py
@@ -353,12 +353,12 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call):
else:
return max(self._deadline - time.time(), 0)
- def add_cancellation_callback(self, callback):
+ def add_callback(self, callback):
with self._state.condition:
if self._state.callbacks is None:
return False
else:
- self._state.callbacks.append(lambda unused_future: callback())
+ self._state.callbacks.append(lambda: callback())
return True
def initial_metadata(self):
diff --git a/src/python/grpcio/grpc/beta/_client_adaptations.py b/src/python/grpcio/grpc/beta/_client_adaptations.py
index 73415e0be7..e4ee44d7a3 100644
--- a/src/python/grpcio/grpc/beta/_client_adaptations.py
+++ b/src/python/grpcio/grpc/beta/_client_adaptations.py
@@ -67,7 +67,7 @@ def _abortion(rpc_error_call):
error_kind = face.Abortion.Kind.LOCAL_FAILURE if pair is None else pair[0]
return face.Abortion(
error_kind, rpc_error_call.initial_metadata(),
- rpc_error_call.trailing_metadata(), code, rpc_error_code.details())
+ rpc_error_call.trailing_metadata(), code, rpc_error_call.details())
def _abortion_error(rpc_error_call):
@@ -159,9 +159,11 @@ class _Rendezvous(future.Future, face.Call):
return self._call.time_remaining()
def add_abortion_callback(self, abortion_callback):
- registered = self._call.add_callback(
- lambda: abortion_callback(_abortion(self._call)))
- return None if registered else _abortion(self._call)
+ def done_callback():
+ if self.code() is not grpc.StatusCode.OK:
+ abortion_callback(_abortion(self._call))
+ registered = self._call.add_callback(done_callback)
+ return None if registered else done_callback()
def protocol_context(self):
return _InvocationProtocolContext()