From: Jérémie Galarneau Date: Fri, 27 Feb 2015 16:34:04 +0000 (-0500) Subject: Cleanup: Reduce scope of relayd connections in live thread X-Git-Tag: v2.6.1~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f89048c17c5baf5bda4e791823e49ffb0d99facc;p=lttng-tools.git Cleanup: Reduce scope of relayd connections in live thread Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index ff2bbda83..938fcd4f5 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1862,13 +1862,13 @@ void *thread_worker(void *data) { int ret, err = -1; uint32_t nb_fd; - struct relay_connection *conn; struct lttng_poll_event events; struct lttng_ht *relay_connections_ht; struct lttng_ht_iter iter; struct lttng_viewer_cmd recv_hdr; struct relay_local_data *relay_ctx = (struct relay_local_data *) data; struct lttng_ht *sessions_ht = relay_ctx->sessions_ht; + struct relay_connection *destroy_conn; DBG("[thread] Live viewer relay worker started"); @@ -1949,6 +1949,8 @@ restart: ERR("Relay live pipe error"); goto error; } else if (revents & LPOLLIN) { + struct relay_connection *conn; + ret = lttng_read(live_conn_pipe[0], &conn, sizeof(conn)); if (ret < 0) { goto error; @@ -1964,6 +1966,8 @@ restart: DBG("Connection socket %d added", conn->sock->fd); } } else { + struct relay_connection *conn; + rcu_read_lock(); conn = connection_find_by_sock(relay_connections_ht, pollfd); /* If not found, there is a synchronization issue. */ @@ -2001,10 +2005,11 @@ error: /* Cleanup reamaining connection object. */ rcu_read_lock(); - cds_lfht_for_each_entry(relay_connections_ht->ht, &iter.iter, conn, + cds_lfht_for_each_entry(relay_connections_ht->ht, &iter.iter, + destroy_conn, sock_n.node) { health_code_update(); - destroy_connection(relay_connections_ht, conn); + destroy_connection(relay_connections_ht, destroy_conn); } rcu_read_unlock(); error_poll_create: