jackdbus: improved handling of server start/stop failures (MERGE from ladi-fixes)

* Don't override detailed error string with generic one
 * Set the D-Bus reply error in case of jackctl_server_stop() failure
 * Set the D-Bus reply error in case of jack_controller_patchbay_init() failure
 * Don't set the D-Bus reply error in case of jack_deactivate() failure because
   this failure does not cause jack_controller_stop_server() failure and thus
   will cause memory leak.

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

View File

@ -1,6 +1,6 @@
/* -*- Mode: C ; c-basic-offset: 4 -*- */
/*
Copyright (C) 2007,2008 Nedko Arnaudov
Copyright (C) 2007,2008,2010 Nedko Arnaudov
Copyright (C) 2007-2008 Juuso Alasuutari
This program is free software; you can redistribute it and/or modify
@ -171,7 +171,6 @@ jack_controller_start_server(
if (controller_ptr->client == NULL)
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to create dbusapi jack client");
goto fail_stop_server;
}
@ -179,13 +178,12 @@ jack_controller_start_server(
if (ret != 0)
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to set xrun callback. error is %d", ret);
goto fail_close_client;
}
if (!jack_controller_patchbay_init(controller_ptr))
{
jack_error("Failed to initialize patchbay district");
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Failed to initialize patchbay district");
goto fail_close_client;
}
@ -193,7 +191,6 @@ jack_controller_start_server(
if (ret != 0)
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to activate dbusapi jack client. error is %d", ret);
goto fail_patchbay_uninit;
}
@ -241,7 +238,7 @@ jack_controller_stop_server(
ret = jack_deactivate(controller_ptr->client);
if (ret != 0)
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to deactivate dbusapi jack client. error is %d", ret);
jack_error("failed to deactivate dbusapi jack client. error is %d", ret);
}
jack_controller_patchbay_uninit(controller_ptr);
@ -256,6 +253,7 @@ jack_controller_stop_server(
if (!jackctl_server_stop(controller_ptr->server))
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Failed to stop server");
return FALSE;
}

View File

@ -1,6 +1,6 @@
/* -*- Mode: C ; c-basic-offset: 4 -*- */
/*
Copyright (C) 2007,2008 Nedko Arnaudov
Copyright (C) 2007,2008,2010 Nedko Arnaudov
Copyright (C) 2007-2008 Juuso Alasuutari
This program is free software; you can redistribute it and/or modify
@ -87,7 +87,8 @@ jack_control_run_method(
{
if (!jack_controller_start_server(controller_ptr, call))
{
jack_dbus_error(call, JACK_DBUS_ERROR_GENERIC, "Failed to start server");
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}
@ -97,7 +98,8 @@ jack_control_run_method(
{
if (!jack_controller_stop_server(controller_ptr, call))
{
jack_dbus_error(call, JACK_DBUS_ERROR_GENERIC, "Failed to stop server");
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}
@ -107,7 +109,8 @@ jack_control_run_method(
{
if (!jack_controller_switch_master(controller_ptr, call))
{
jack_dbus_error(call, JACK_DBUS_ERROR_GENERIC, "Failed to switch master");
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}