aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2017-03-24 00:54:47 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2017-03-24 00:54:47 +0100
commite44a50ffd740e576938f2d6892350cc337051924 (patch)
tree19dff6f774731c6c40f229a8373585e32f98c94c /src/core
parent6f1e443a519cd28d97be78c5ca2ca72a45f6b598 (diff)
parentd0432ff5af7f6af26d441bc05454f9f511843628 (diff)
Merge branch 'v1.2.x' of https://github.com/grpc/grpc into upmerge-1.2.0
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lib/iomgr/tcp_server_posix.c7
-rw-r--r--src/core/lib/iomgr/timer_uv.c4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c
index e1efbd414f..d6a017cf7f 100644
--- a/src/core/lib/iomgr/tcp_server_posix.c
+++ b/src/core/lib/iomgr/tcp_server_posix.c
@@ -185,10 +185,7 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
/* delete ALL the things */
gpr_mu_lock(&s->mu);
- if (!s->shutdown) {
- gpr_mu_unlock(&s->mu);
- return;
- }
+ GPR_ASSERT(s->shutdown);
if (s->head) {
grpc_tcp_listener *sp;
@@ -301,7 +298,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *err) {
error:
gpr_mu_lock(&sp->server->mu);
- if (0 == --sp->server->active_ports) {
+ if (0 == --sp->server->active_ports && sp->server->shutdown) {
gpr_mu_unlock(&sp->server->mu);
deactivated_all_ports(exec_ctx, sp->server);
} else {
diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c
index f28a14405d..8e8a07578c 100644
--- a/src/core/lib/iomgr/timer_uv.c
+++ b/src/core/lib/iomgr/timer_uv.c
@@ -78,6 +78,10 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
uv_timer->data = timer;
timer->uv_timer = uv_timer;
uv_timer_start(uv_timer, run_expired_timer, timeout, 0);
+ /* We assume that gRPC timers are only used alongside other active gRPC
+ objects, and that there will therefore always be something else keeping
+ the uv loop alive whenever there is a timer */
+ uv_unref((uv_handle_t *)uv_timer);
}
void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) {