aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2017-03-24 10:06:43 -0700
committerGravatar GitHub <noreply@github.com>2017-03-24 10:06:43 -0700
commitaf61d0b7b4b9cd48b424c3c6f7c0b3c3be2ae270 (patch)
treeb0ec84036a8cdd4b5fe840fa784443615e4f3761 /src/core/lib
parent18a7a8a9637b45e220202145b4b51dc224fbbdac (diff)
parente44a50ffd740e576938f2d6892350cc337051924 (diff)
Merge pull request #10293 from nicolasnoble/upmerge-1.2.0
Upmerge from 1.2.0
Diffstat (limited to 'src/core/lib')
-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) {