Fix: Don't send agent disable event command twice
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 3 Aug 2015 20:45:00 +0000 (16:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 3 Aug 2015 20:51:57 +0000 (16:51 -0400)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/agent.c

index afc3712a7127007b8d06b19bcd815893fcc33e68..50a6a7b1ea444728ea72701114856501e84bff18 100644 (file)
@@ -443,7 +443,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);
 }
 
 /*
@@ -493,11 +493,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();
 
@@ -515,10 +518,10 @@ int agent_disable_event(struct agent_event *event,
        }
 
        event->enabled = 0;
-       ret = LTTNG_OK;
 
 error:
        rcu_read_unlock();
+end:
        return ret;
 }
 
This page took 0.033062 seconds and 4 git commands to generate.