mirror of https://github.com/grpc/grpc.git
commit
f123443aa5
41 changed files with 683 additions and 612 deletions
@ -1,56 +0,0 @@ |
|||||||
/*
|
|
||||||
* |
|
||||||
* Copyright 2015, Google Inc. |
|
||||||
* All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * Redistributions in binary form must reproduce the above |
|
||||||
* copyright notice, this list of conditions and the following disclaimer |
|
||||||
* in the documentation and/or other materials provided with the |
|
||||||
* distribution. |
|
||||||
* * Neither the name of Google Inc. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef GRPC_SUPPORT_CANCELLABLE_PLATFORM_H |
|
||||||
#define GRPC_SUPPORT_CANCELLABLE_PLATFORM_H |
|
||||||
|
|
||||||
#include <grpc/support/atm.h> |
|
||||||
#include <grpc/support/sync.h> |
|
||||||
|
|
||||||
struct gpr_cancellable_list_ { |
|
||||||
/* a doubly-linked list on cancellable's waiters queue */ |
|
||||||
struct gpr_cancellable_list_ *next; |
|
||||||
struct gpr_cancellable_list_ *prev; |
|
||||||
/* The following two fields are arguments to gpr_cv_cancellable_wait() */ |
|
||||||
gpr_mu *mu; |
|
||||||
gpr_cv *cv; |
|
||||||
}; |
|
||||||
|
|
||||||
/* Internal definition of gpr_cancellable. */ |
|
||||||
typedef struct { |
|
||||||
gpr_mu mu; /* protects waiters and modifications to cancelled */ |
|
||||||
gpr_atm cancelled; |
|
||||||
struct gpr_cancellable_list_ waiters; |
|
||||||
} gpr_cancellable; |
|
||||||
|
|
||||||
#endif /* GRPC_SUPPORT_CANCELLABLE_PLATFORM_H */ |
|
@ -1,157 +0,0 @@ |
|||||||
/*
|
|
||||||
* |
|
||||||
* Copyright 2015, Google Inc. |
|
||||||
* All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * Redistributions in binary form must reproduce the above |
|
||||||
* copyright notice, this list of conditions and the following disclaimer |
|
||||||
* in the documentation and/or other materials provided with the |
|
||||||
* distribution. |
|
||||||
* * Neither the name of Google Inc. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/* Implementation for gpr_cancellable */ |
|
||||||
|
|
||||||
#include <grpc/support/atm.h> |
|
||||||
#include <grpc/support/sync.h> |
|
||||||
#include <grpc/support/time.h> |
|
||||||
|
|
||||||
void gpr_cancellable_init(gpr_cancellable *c) { |
|
||||||
gpr_mu_init(&c->mu); |
|
||||||
c->cancelled = 0; |
|
||||||
c->waiters.next = &c->waiters; |
|
||||||
c->waiters.prev = &c->waiters; |
|
||||||
c->waiters.mu = NULL; |
|
||||||
c->waiters.cv = NULL; |
|
||||||
} |
|
||||||
|
|
||||||
void gpr_cancellable_destroy(gpr_cancellable *c) { gpr_mu_destroy(&c->mu); } |
|
||||||
|
|
||||||
int gpr_cancellable_is_cancelled(gpr_cancellable *c) { |
|
||||||
return gpr_atm_acq_load(&c->cancelled) != 0; |
|
||||||
} |
|
||||||
|
|
||||||
/* Threads in gpr_cv_cancellable_wait(cv, mu, ..., c) place themselves on a
|
|
||||||
linked list c->waiters of gpr_cancellable_list_ before waiting on their |
|
||||||
condition variables. They check for cancellation while holding *mu. Thus, |
|
||||||
to wake a thread from gpr_cv_cancellable_wait(), it suffices to: |
|
||||||
- set c->cancelled |
|
||||||
- acquire and release *mu |
|
||||||
- gpr_cv_broadcast(cv) |
|
||||||
|
|
||||||
However, gpr_cancellable_cancel() may not use gpr_mu_lock(mu), since the |
|
||||||
caller may already hold *mu---a possible deadlock. (If we knew the caller |
|
||||||
did not hold *mu, care would still be needed, because c->mu follows *mu in |
|
||||||
the locking order, so *mu could not be acquired while holding c->mu---which |
|
||||||
is needed to iterate over c->waiters.) |
|
||||||
|
|
||||||
Therefore, gpr_cancellable_cancel() uses gpr_mu_trylock() rather than |
|
||||||
gpr_mu_lock(), and retries until either gpr_mu_trylock() succeeds or the |
|
||||||
thread leaves gpr_cv_cancellable_wait() for other reasons. In the first |
|
||||||
case, gpr_cancellable_cancel() removes the entry from the waiters list; in |
|
||||||
the second, the waiting thread removes itself from the list. |
|
||||||
|
|
||||||
A one-entry cache of mutexes and condition variables processed is kept to |
|
||||||
avoid doing the same work again and again if many threads are blocked in the |
|
||||||
same place. However, it's important to broadcast on a condition variable if |
|
||||||
the corresponding mutex has been locked successfully, even if the condition |
|
||||||
variable has been signalled before. */ |
|
||||||
|
|
||||||
void gpr_cancellable_cancel(gpr_cancellable *c) { |
|
||||||
if (!gpr_cancellable_is_cancelled(c)) { |
|
||||||
int failures; |
|
||||||
int backoff = 1; |
|
||||||
do { |
|
||||||
struct gpr_cancellable_list_ *l; |
|
||||||
struct gpr_cancellable_list_ *nl; |
|
||||||
gpr_mu *omu = 0; /* one-element cache of a processed gpr_mu */ |
|
||||||
gpr_cv *ocv = 0; /* one-element cache of a processd gpr_cv */ |
|
||||||
gpr_mu_lock(&c->mu); |
|
||||||
gpr_atm_rel_store(&c->cancelled, 1); |
|
||||||
failures = 0; |
|
||||||
for (l = c->waiters.next; l != &c->waiters; l = nl) { |
|
||||||
nl = l->next; |
|
||||||
if (omu != l->mu) { |
|
||||||
omu = l->mu; |
|
||||||
if (gpr_mu_trylock(l->mu)) { |
|
||||||
gpr_mu_unlock(l->mu); |
|
||||||
l->next->prev = l->prev; /* remove *l from list */ |
|
||||||
l->prev->next = l->next; |
|
||||||
/* allow unconditional dequeue in gpr_cv_cancellable_wait() */ |
|
||||||
l->next = l; |
|
||||||
l->prev = l; |
|
||||||
ocv = 0; /* force broadcast */ |
|
||||||
} else { |
|
||||||
failures++; |
|
||||||
} |
|
||||||
} |
|
||||||
if (ocv != l->cv) { |
|
||||||
ocv = l->cv; |
|
||||||
gpr_cv_broadcast(l->cv); |
|
||||||
} |
|
||||||
} |
|
||||||
gpr_mu_unlock(&c->mu); |
|
||||||
if (failures != 0) { |
|
||||||
if (backoff < 10) { |
|
||||||
volatile int i; |
|
||||||
for (i = 0; i != (1 << backoff); i++) { |
|
||||||
} |
|
||||||
backoff++; |
|
||||||
} else { |
|
||||||
gpr_event ev; |
|
||||||
gpr_event_init(&ev); |
|
||||||
gpr_event_wait( |
|
||||||
&ev, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000, GPR_TIMESPAN))); |
|
||||||
} |
|
||||||
} |
|
||||||
} while (failures != 0); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
int gpr_cv_cancellable_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline, |
|
||||||
gpr_cancellable *c) { |
|
||||||
gpr_int32 timeout; |
|
||||||
gpr_mu_lock(&c->mu); |
|
||||||
timeout = gpr_cancellable_is_cancelled(c); |
|
||||||
if (!timeout) { |
|
||||||
struct gpr_cancellable_list_ le; |
|
||||||
le.mu = mu; |
|
||||||
le.cv = cv; |
|
||||||
le.next = c->waiters.next; |
|
||||||
le.prev = &c->waiters; |
|
||||||
le.next->prev = ≤ |
|
||||||
le.prev->next = ≤ |
|
||||||
gpr_mu_unlock(&c->mu); |
|
||||||
timeout = gpr_cv_wait(cv, mu, abs_deadline); |
|
||||||
gpr_mu_lock(&c->mu); |
|
||||||
le.next->prev = le.prev; |
|
||||||
le.prev->next = le.next; |
|
||||||
if (!timeout) { |
|
||||||
timeout = gpr_cancellable_is_cancelled(c); |
|
||||||
} |
|
||||||
} |
|
||||||
gpr_mu_unlock(&c->mu); |
|
||||||
return timeout; |
|
||||||
} |
|
@ -0,0 +1,2 @@ |
|||||||
|
graft grpc |
||||||
|
include commands.py |
@ -0,0 +1,9 @@ |
|||||||
|
gRPC Python Health Checking |
||||||
|
=========================== |
||||||
|
|
||||||
|
Reference package for GRPC Python health checking. |
||||||
|
|
||||||
|
Dependencies |
||||||
|
------------ |
||||||
|
|
||||||
|
Depends on the `grpcio` package, available from PyPI via `pip install grpcio`. |
@ -0,0 +1,80 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
"""Provides distutils command classes for the GRPC Python setup process.""" |
||||||
|
|
||||||
|
import distutils |
||||||
|
import glob |
||||||
|
import os |
||||||
|
import os.path |
||||||
|
import subprocess |
||||||
|
import sys |
||||||
|
|
||||||
|
import setuptools |
||||||
|
from setuptools.command import build_py |
||||||
|
|
||||||
|
|
||||||
|
class BuildProtoModules(setuptools.Command): |
||||||
|
"""Command to generate project *_pb2.py modules from proto files.""" |
||||||
|
|
||||||
|
description = '' |
||||||
|
user_options = [] |
||||||
|
|
||||||
|
def initialize_options(self): |
||||||
|
pass |
||||||
|
|
||||||
|
def finalize_options(self): |
||||||
|
self.protoc_command = 'protoc' |
||||||
|
self.grpc_python_plugin_command = distutils.spawn.find_executable( |
||||||
|
'grpc_python_plugin') |
||||||
|
|
||||||
|
def run(self): |
||||||
|
paths = [] |
||||||
|
root_directory = os.getcwd() |
||||||
|
for walk_root, directories, filenames in os.walk(root_directory): |
||||||
|
for filename in filenames: |
||||||
|
if filename.endswith('.proto'): |
||||||
|
paths.append(os.path.join(walk_root, filename)) |
||||||
|
command = [ |
||||||
|
self.protoc_command, |
||||||
|
'--plugin=protoc-gen-python-grpc={}'.format( |
||||||
|
self.grpc_python_plugin_command), |
||||||
|
'-I {}'.format(root_directory), |
||||||
|
'--python_out={}'.format(root_directory), |
||||||
|
'--python-grpc_out={}'.format(root_directory), |
||||||
|
] + paths |
||||||
|
subprocess.check_call(' '.join(command), cwd=root_directory, shell=True) |
||||||
|
|
||||||
|
|
||||||
|
class BuildPy(build_py.build_py): |
||||||
|
"""Custom project build command.""" |
||||||
|
|
||||||
|
def run(self): |
||||||
|
self.run_command('build_proto_modules') |
||||||
|
build_py.build_py.run(self) |
@ -0,0 +1,30 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@ |
|||||||
|
// Copyright 2015, Google Inc. |
||||||
|
// All rights reserved. |
||||||
|
// |
||||||
|
// Redistribution and use in source and binary forms, with or without |
||||||
|
// modification, are permitted provided that the following conditions are |
||||||
|
// met: |
||||||
|
// |
||||||
|
// * Redistributions of source code must retain the above copyright |
||||||
|
// notice, this list of conditions and the following disclaimer. |
||||||
|
// * Redistributions in binary form must reproduce the above |
||||||
|
// copyright notice, this list of conditions and the following disclaimer |
||||||
|
// in the documentation and/or other materials provided with the |
||||||
|
// distribution. |
||||||
|
// * Neither the name of Google Inc. nor the names of its |
||||||
|
// contributors may be used to endorse or promote products derived from |
||||||
|
// this software without specific prior written permission. |
||||||
|
// |
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package grpc.health.v1alpha; |
||||||
|
|
||||||
|
message HealthCheckRequest { |
||||||
|
string service = 1; |
||||||
|
} |
||||||
|
|
||||||
|
message HealthCheckResponse { |
||||||
|
enum ServingStatus { |
||||||
|
UNKNOWN = 0; |
||||||
|
SERVING = 1; |
||||||
|
NOT_SERVING = 2; |
||||||
|
} |
||||||
|
ServingStatus status = 1; |
||||||
|
} |
||||||
|
|
||||||
|
service Health { |
||||||
|
rpc Check(HealthCheckRequest) returns (HealthCheckResponse); |
||||||
|
} |
@ -0,0 +1,129 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
"""Reference implementation for health checking in gRPC Python.""" |
||||||
|
|
||||||
|
import abc |
||||||
|
import enum |
||||||
|
import threading |
||||||
|
|
||||||
|
from grpc.health.v1alpha import health_pb2 |
||||||
|
|
||||||
|
|
||||||
|
@enum.unique |
||||||
|
class HealthStatus(enum.Enum): |
||||||
|
"""Statuses for a service mirroring the reference health.proto's values.""" |
||||||
|
UNKNOWN = health_pb2.HealthCheckResponse.UNKNOWN |
||||||
|
SERVING = health_pb2.HealthCheckResponse.SERVING |
||||||
|
NOT_SERVING = health_pb2.HealthCheckResponse.NOT_SERVING |
||||||
|
|
||||||
|
|
||||||
|
class _HealthServicer(health_pb2.EarlyAdopterHealthServicer): |
||||||
|
"""Servicer handling RPCs for service statuses.""" |
||||||
|
|
||||||
|
def __init__(self): |
||||||
|
self._server_status_lock = threading.Lock() |
||||||
|
self._server_status = {} |
||||||
|
|
||||||
|
def Check(self, request, context): |
||||||
|
with self._server_status_lock: |
||||||
|
if request.service not in self._server_status: |
||||||
|
# TODO(atash): once the Python API has a way of setting the server |
||||||
|
# status, bring us into conformance with the health check spec by |
||||||
|
# returning the NOT_FOUND status here. |
||||||
|
raise NotImplementedError() |
||||||
|
else: |
||||||
|
return health_pb2.HealthCheckResponse( |
||||||
|
status=self._server_status[request.service].value) |
||||||
|
|
||||||
|
def set(service, status): |
||||||
|
if not isinstance(status, HealthStatus): |
||||||
|
raise TypeError('expected grpc.health.v1alpha.health.HealthStatus ' |
||||||
|
'for argument `status` but got {}'.format(status)) |
||||||
|
with self._server_status_lock: |
||||||
|
self._server_status[service] = status |
||||||
|
|
||||||
|
|
||||||
|
class HealthServer(health_pb2.EarlyAdopterHealthServer): |
||||||
|
"""Interface for the reference gRPC Python health server.""" |
||||||
|
__metaclass__ = abc.ABCMeta |
||||||
|
|
||||||
|
@abc.abstractmethod |
||||||
|
def start(self): |
||||||
|
raise NotImplementedError() |
||||||
|
|
||||||
|
@abc.abstractmethod |
||||||
|
def stop(self): |
||||||
|
raise NotImplementedError() |
||||||
|
|
||||||
|
@abc.abstractmethod |
||||||
|
def set(self, service, status): |
||||||
|
"""Set the status of the given service. |
||||||
|
|
||||||
|
Args: |
||||||
|
service (str): service name of the service to set the reported status of |
||||||
|
status (HealthStatus): status to set for the specified service |
||||||
|
""" |
||||||
|
raise NotImplementedError() |
||||||
|
|
||||||
|
|
||||||
|
class _HealthServerImplementation(HealthServer): |
||||||
|
"""Implementation for the reference gRPC Python health server.""" |
||||||
|
|
||||||
|
def __init__(self, server, servicer): |
||||||
|
self._server = server |
||||||
|
self._servicer = servicer |
||||||
|
|
||||||
|
def start(self): |
||||||
|
self._server.start() |
||||||
|
|
||||||
|
def stop(self): |
||||||
|
self._server.stop() |
||||||
|
|
||||||
|
def set(self, service, status): |
||||||
|
self._servicer.set(service, status) |
||||||
|
|
||||||
|
|
||||||
|
def create_Health_server(port, private_key=None, certificate_chain=None): |
||||||
|
"""Get a HealthServer instance. |
||||||
|
|
||||||
|
Args: |
||||||
|
port (int): port number passed through to health_pb2 server creation |
||||||
|
routine. |
||||||
|
private_key (str): to-be-created server's desired private key |
||||||
|
certificate_chain (str): to-be-created server's desired certificate chain |
||||||
|
|
||||||
|
Returns: |
||||||
|
An instance of HealthServer (conforming thus to |
||||||
|
EarlyAdopterHealthServer and providing a method to set server status).""" |
||||||
|
servicer = _HealthServicer() |
||||||
|
server = health_pb2.early_adopter_create_Health_server( |
||||||
|
servicer, port=port, private_key=private_key, |
||||||
|
certificate_chain=certificate_chain) |
||||||
|
return _HealthServerImplementation(server, servicer) |
@ -0,0 +1,72 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
"""Setup module for the GRPC Python package's optional health checking.""" |
||||||
|
|
||||||
|
import os |
||||||
|
import os.path |
||||||
|
import sys |
||||||
|
|
||||||
|
from distutils import core as _core |
||||||
|
import setuptools |
||||||
|
|
||||||
|
# Ensure we're in the proper directory whether or not we're being used by pip. |
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__))) |
||||||
|
|
||||||
|
# Break import-style to ensure we can actually find our commands module. |
||||||
|
import commands |
||||||
|
|
||||||
|
_PACKAGES = ( |
||||||
|
setuptools.find_packages('.') |
||||||
|
) |
||||||
|
|
||||||
|
_PACKAGE_DIRECTORIES = { |
||||||
|
'': '.', |
||||||
|
} |
||||||
|
|
||||||
|
_INSTALL_REQUIRES = ( |
||||||
|
'grpcio>=0.10.0a0', |
||||||
|
) |
||||||
|
|
||||||
|
_SETUP_REQUIRES = _INSTALL_REQUIRES |
||||||
|
|
||||||
|
_COMMAND_CLASS = { |
||||||
|
'build_proto_modules': commands.BuildProtoModules, |
||||||
|
'build_py': commands.BuildPy, |
||||||
|
} |
||||||
|
|
||||||
|
setuptools.setup( |
||||||
|
name='grpcio_health_checking', |
||||||
|
version='0.10.0a0', |
||||||
|
packages=list(_PACKAGES), |
||||||
|
package_dir=_PACKAGE_DIRECTORIES, |
||||||
|
install_requires=_INSTALL_REQUIRES, |
||||||
|
setup_requires=_SETUP_REQUIRES, |
||||||
|
cmdclass=_COMMAND_CLASS |
||||||
|
) |
@ -1,172 +0,0 @@ |
|||||||
/*
|
|
||||||
* |
|
||||||
* Copyright 2015, Google Inc. |
|
||||||
* All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * Redistributions in binary form must reproduce the above |
|
||||||
* copyright notice, this list of conditions and the following disclaimer |
|
||||||
* in the documentation and/or other materials provided with the |
|
||||||
* distribution. |
|
||||||
* * Neither the name of Google Inc. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/* Test of gpr_cancellable. */ |
|
||||||
|
|
||||||
#include <stdio.h> |
|
||||||
#include <stdlib.h> |
|
||||||
#include <grpc/support/log.h> |
|
||||||
#include <grpc/support/sync.h> |
|
||||||
#include <grpc/support/thd.h> |
|
||||||
#include <grpc/support/time.h> |
|
||||||
#include "test/core/util/test_config.h" |
|
||||||
|
|
||||||
struct test { |
|
||||||
gpr_mu mu; |
|
||||||
gpr_cv cv; |
|
||||||
gpr_event ev; |
|
||||||
gpr_event done; |
|
||||||
gpr_cancellable cancel; |
|
||||||
int n; |
|
||||||
}; |
|
||||||
|
|
||||||
/* A thread body. Wait until t->cancel is cancelledm then
|
|
||||||
decrement t->n. If t->n becomes 0, set t->done. */ |
|
||||||
static void thd_body(void *v) { |
|
||||||
struct test *t = v; |
|
||||||
gpr_mu_lock(&t->mu); |
|
||||||
while (!gpr_cv_cancellable_wait( |
|
||||||
&t->cv, &t->mu, gpr_inf_future(GPR_CLOCK_REALTIME), &t->cancel)) { |
|
||||||
} |
|
||||||
t->n--; |
|
||||||
if (t->n == 0) { |
|
||||||
gpr_event_set(&t->done, (void *)1); |
|
||||||
} |
|
||||||
gpr_mu_unlock(&t->mu); |
|
||||||
} |
|
||||||
|
|
||||||
static void test(void) { |
|
||||||
int i; |
|
||||||
gpr_thd_id thd; |
|
||||||
struct test t; |
|
||||||
int n = 1; |
|
||||||
gpr_timespec interval; |
|
||||||
|
|
||||||
gpr_mu_init(&t.mu); |
|
||||||
gpr_cv_init(&t.cv); |
|
||||||
gpr_event_init(&t.ev); |
|
||||||
gpr_event_init(&t.done); |
|
||||||
gpr_cancellable_init(&t.cancel); |
|
||||||
|
|
||||||
/* A gpr_cancellable starts not cancelled. */ |
|
||||||
GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel)); |
|
||||||
|
|
||||||
/* Test timeout on event wait for uncancelled gpr_cancellable */ |
|
||||||
interval = gpr_now(GPR_CLOCK_REALTIME); |
|
||||||
gpr_event_cancellable_wait( |
|
||||||
&t.ev, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000000, GPR_TIMESPAN)), |
|
||||||
&t.cancel); |
|
||||||
interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(interval, gpr_time_from_micros(500000, GPR_TIMESPAN)) >= 0); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(gpr_time_from_micros(2000000, GPR_TIMESPAN), interval) >= 0); |
|
||||||
|
|
||||||
/* Test timeout on cv wait for uncancelled gpr_cancellable */ |
|
||||||
gpr_mu_lock(&t.mu); |
|
||||||
interval = gpr_now(GPR_CLOCK_REALTIME); |
|
||||||
while (!gpr_cv_cancellable_wait( |
|
||||||
&t.cv, &t.mu, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000000, GPR_TIMESPAN)), |
|
||||||
&t.cancel)) { |
|
||||||
} |
|
||||||
interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(interval, gpr_time_from_micros(500000, GPR_TIMESPAN)) >= 0); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(gpr_time_from_micros(2000000, GPR_TIMESPAN), interval) >= 0); |
|
||||||
gpr_mu_unlock(&t.mu); |
|
||||||
|
|
||||||
/* Create some threads. They all wait until cancelled; the last to finish
|
|
||||||
sets t.done. */ |
|
||||||
t.n = n; |
|
||||||
for (i = 0; i != n; i++) { |
|
||||||
GPR_ASSERT(gpr_thd_new(&thd, &thd_body, &t, NULL)); |
|
||||||
} |
|
||||||
/* Check that t.cancel still is not cancelled. */ |
|
||||||
GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel)); |
|
||||||
|
|
||||||
/* Wait a second, and check that no threads have finished waiting. */ |
|
||||||
gpr_mu_lock(&t.mu); |
|
||||||
gpr_cv_wait(&t.cv, &t.mu, |
|
||||||
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000000, GPR_TIMESPAN))); |
|
||||||
GPR_ASSERT(t.n == n); |
|
||||||
gpr_mu_unlock(&t.mu); |
|
||||||
|
|
||||||
/* Check that t.cancel still is not cancelled, but when
|
|
||||||
cancelled it retports that it is cacncelled. */ |
|
||||||
GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel)); |
|
||||||
gpr_cancellable_cancel(&t.cancel); |
|
||||||
GPR_ASSERT(gpr_cancellable_is_cancelled(&t.cancel)); |
|
||||||
|
|
||||||
/* Wait for threads to finish. */ |
|
||||||
gpr_event_wait(&t.done, gpr_inf_future(GPR_CLOCK_REALTIME)); |
|
||||||
GPR_ASSERT(t.n == 0); |
|
||||||
|
|
||||||
/* Test timeout on cv wait for cancelled gpr_cancellable */ |
|
||||||
gpr_mu_lock(&t.mu); |
|
||||||
interval = gpr_now(GPR_CLOCK_REALTIME); |
|
||||||
while (!gpr_cv_cancellable_wait( |
|
||||||
&t.cv, &t.mu, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000000, GPR_TIMESPAN)), |
|
||||||
&t.cancel)) { |
|
||||||
} |
|
||||||
interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(gpr_time_from_micros(100000, GPR_TIMESPAN), interval) >= 0); |
|
||||||
gpr_mu_unlock(&t.mu); |
|
||||||
|
|
||||||
/* Test timeout on event wait for cancelled gpr_cancellable */ |
|
||||||
interval = gpr_now(GPR_CLOCK_REALTIME); |
|
||||||
gpr_event_cancellable_wait( |
|
||||||
&t.ev, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
||||||
gpr_time_from_micros(1000000, GPR_TIMESPAN)), |
|
||||||
&t.cancel); |
|
||||||
interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval); |
|
||||||
GPR_ASSERT( |
|
||||||
gpr_time_cmp(gpr_time_from_micros(100000, GPR_TIMESPAN), interval) >= 0); |
|
||||||
|
|
||||||
gpr_mu_destroy(&t.mu); |
|
||||||
gpr_cv_destroy(&t.cv); |
|
||||||
gpr_cancellable_destroy(&t.cancel); |
|
||||||
} |
|
||||||
|
|
||||||
/* ------------------------------------------------- */ |
|
||||||
|
|
||||||
int main(int argc, char *argv[]) { |
|
||||||
grpc_test_init(argc, argv); |
|
||||||
test(); |
|
||||||
return 0; |
|
||||||
} |
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue