jackdbus: dont emit spurious signals. Fix for #174 (MERGE from ladi-fixes)

When server is already in target state, there is no state change
and thus signal for state change should not be emitted

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4010 0c269be4-1314-0410-8aa9-9f06e86f4224
This commit is contained in:
nedko 2010-05-10 00:16:03 +00:00
commit 8c4f03ed21
2 changed files with 27 additions and 20 deletions

View File

@ -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)

View File

@ -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)
{