Commit d1090f0d authored by Nedko Arnaudov's avatar Nedko Arnaudov
Browse files

jackdbus: dont emit spurious signals. Fix for #174

When server is already in target state, there is no state change
and thus signal for state change should not be emitted
parent becacb17
......@@ -25,6 +25,7 @@
#include <stdint.h>
#include <string.h>
#include <dbus/dbus.h>
#include <assert.h>
#include "controller.h"
#include "controller_internal.h"
......@@ -142,11 +143,7 @@ jack_controller_start_server(
jack_info("Starting jack server...");
if (controller_ptr->started)
{
jack_info("Already started.");
return TRUE;
}
assert(!controller_ptr->started); /* should be ensured by caller */
if (controller_ptr->driver == NULL)
{
......@@ -229,11 +226,7 @@ jack_controller_stop_server(
jack_info("Stopping jack server...");
if (!controller_ptr->started)
{
jack_info("Already stopped.");
return TRUE;
}
assert(controller_ptr->started); /* should be ensured by caller */
ret = jack_deactivate(controller_ptr->client);
if (ret != 0)
......
......@@ -85,25 +85,39 @@ jack_control_run_method(
}
else if (strcmp (call->method_name, "StartServer") == 0)
{
if (!jack_controller_start_server(controller_ptr, call))
if (controller_ptr->started)
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
jack_info("Ignoring JACK server start request because server is already started.");
}
else
{
if (!jack_controller_start_server(controller_ptr, call))
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}
jack_controller_control_send_signal_server_started();
}
jack_controller_control_send_signal_server_started();
}
else if (strcmp (call->method_name, "StopServer") == 0)
{
if (!jack_controller_stop_server(controller_ptr, call))
if (!controller_ptr->started)
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
jack_info("Ignoring JACK server stop request because server is already stopped.");
}
else
{
if (!jack_controller_stop_server(controller_ptr, call))
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}
jack_controller_control_send_signal_server_stopped();
}
jack_controller_control_send_signal_server_stopped();
}
else if (strcmp (call->method_name, "SwitchMaster") == 0)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment