aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
diff options
context:
space:
mode:
authorGravatar siddharthshukla <s.shukla@jacobs-university.de>2016-07-12 14:02:12 +0200
committerGravatar siddharthshukla <siddharthshukla@outlook.com>2016-08-05 20:14:20 +0200
commit9eedb4ffd74aed8d246a07f8007960b2bc167f55 (patch)
tree6eaacdc00465a55edb0343e81acc34b046babb79 /src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
parentffbfd01049fc2ae4e402539905ebcfa22c1094e8 (diff)
Switch init/shutdown: lib-wide -> per-object
Incremental changes towards PyPy support.
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi')
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
index 035ac49a8b..04872b9c09 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
@@ -33,6 +33,7 @@ cimport cpython
cdef class ChannelCredentials:
def __cinit__(self):
+ grpc_init()
self.c_credentials = NULL
self.c_ssl_pem_key_cert_pair.private_key = NULL
self.c_ssl_pem_key_cert_pair.certificate_chain = NULL
@@ -47,11 +48,13 @@ cdef class ChannelCredentials:
def __dealloc__(self):
if self.c_credentials != NULL:
grpc_channel_credentials_release(self.c_credentials)
+ grpc_shutdown()
cdef class CallCredentials:
def __cinit__(self):
+ grpc_init()
self.c_credentials = NULL
self.references = []
@@ -64,17 +67,20 @@ cdef class CallCredentials:
def __dealloc__(self):
if self.c_credentials != NULL:
grpc_call_credentials_release(self.c_credentials)
+ grpc_shutdown()
cdef class ServerCredentials:
def __cinit__(self):
+ grpc_init()
self.c_credentials = NULL
self.references = []
def __dealloc__(self):
if self.c_credentials != NULL:
grpc_server_credentials_release(self.c_credentials)
+ grpc_shutdown()
cdef class CredentialsMetadataPlugin:
@@ -90,6 +96,7 @@ cdef class CredentialsMetadataPlugin:
successful).
name (bytes): Plugin name.
"""
+ grpc_init()
if not callable(plugin_callback):
raise ValueError('expected callable plugin_callback')
self.plugin_callback = plugin_callback
@@ -105,10 +112,14 @@ cdef class CredentialsMetadataPlugin:
cpython.Py_INCREF(self)
return result
+ def __dealloc__(self):
+ grpc_shutdown()
+
cdef class AuthMetadataContext:
def __cinit__(self):
+ grpc_init()
self.context.service_url = NULL
self.context.method_name = NULL
@@ -120,6 +131,9 @@ cdef class AuthMetadataContext:
def method_name(self):
return self.context.method_name
+ def __dealloc__(self):
+ grpc_shutdown()
+
cdef void plugin_get_metadata(
void *state, grpc_auth_metadata_context context,