From 515a416994071b2f680b412434b5b6285f15f495 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 3 Aug 2015 16:45:00 -0400 Subject: [PATCH] Fix: Don't send agent disable event command twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The session daemon sends a "disable event" command to agents for each event, enabled or not, on session destroy. This had no adverse effect of the Java agent since it suffered from an unrelated bug which ignored any refcount decrementation. This fix bumps the command version to "1" to indicate that this behavior is fixed on the session daemon's end. Fixes #884 Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/agent.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c index e89adbb10..67ca60469 100644 --- a/src/bin/lttng-sessiond/agent.c +++ b/src/bin/lttng-sessiond/agent.c @@ -444,7 +444,7 @@ int agent_send_registration_done(struct agent_app *app) DBG("Agent sending registration done to app socket %d", app->sock->fd); - return send_header(app->sock, 0, AGENT_CMD_REG_DONE, 0); + return send_header(app->sock, 0, AGENT_CMD_REG_DONE, 1); } /* @@ -494,11 +494,14 @@ error: int agent_disable_event(struct agent_event *event, enum lttng_domain_type domain) { - int ret; + int ret = LTTNG_OK; struct agent_app *app; struct lttng_ht_iter iter; assert(event); + if (!event->enabled) { + goto end; + } rcu_read_lock(); @@ -516,10 +519,10 @@ int agent_disable_event(struct agent_event *event, } event->enabled = 0; - ret = LTTNG_OK; error: rcu_read_unlock(); +end: return ret; } -- 2.34.1