Move the dbus call default timeout define out of the interface header
The default timeout is a property of the implementation, not the interface
This commit is contained in:
parent
b8852eaf9f
commit
ff8348650a
|
@ -38,6 +38,8 @@
|
|||
#include "../assert.h"
|
||||
#include "../common/klist.h"
|
||||
|
||||
#define DBUS_CALL_DEFAULT_TIMEOUT 3000 // in milliseconds
|
||||
|
||||
DBusConnection * g_dbus_connection;
|
||||
DBusError g_dbus_error;
|
||||
|
||||
|
@ -332,6 +334,32 @@ bool dbus_add_dict_entry_bool(DBusMessageIter * dict_iter_ptr, const char * key,
|
|||
return true;
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
dbus_call_raw(
|
||||
unsigned int timeout,
|
||||
DBusMessage * request_ptr)
|
||||
{
|
||||
DBusMessage * reply_ptr;
|
||||
|
||||
if (timeout == 0)
|
||||
{
|
||||
timeout = DBUS_CALL_DEFAULT_TIMEOUT;
|
||||
}
|
||||
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
timeout,
|
||||
&g_dbus_error);
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
//log_error("calling method '%s' failed, error is '%s'", method, g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
}
|
||||
|
||||
return reply_ptr;
|
||||
}
|
||||
|
||||
bool
|
||||
dbus_call(
|
||||
unsigned int timeout,
|
||||
|
@ -355,11 +383,6 @@ dbus_call(
|
|||
|
||||
//log_info("dbus_call('%s', '%s', '%s', '%s')", service, object, iface, method);
|
||||
|
||||
if (timeout == 0)
|
||||
{
|
||||
timeout = DBUS_CALL_DEFAULT_TIMEOUT;
|
||||
}
|
||||
|
||||
ret = false;
|
||||
va_start(ap, input_signature);
|
||||
|
||||
|
@ -410,11 +433,7 @@ dbus_call(
|
|||
|
||||
output_signature = va_arg(ap, const char *);
|
||||
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
timeout,
|
||||
&g_dbus_error);
|
||||
reply_ptr = dbus_call_raw(timeout, request_ptr);
|
||||
|
||||
if (input_signature != NULL)
|
||||
{
|
||||
|
@ -423,8 +442,6 @@ dbus_call(
|
|||
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
//log_error("calling method '%s' failed, error is '%s'", method, g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@ bool dbus_maybe_add_dict_entry_string(DBusMessageIter *dict_iter_ptr, const char
|
|||
bool dbus_add_dict_entry_uint32(DBusMessageIter * dict_iter_ptr, const char * key, dbus_uint32_t value);
|
||||
bool dbus_add_dict_entry_bool(DBusMessageIter * dict_iter_ptr, const char * key, dbus_bool_t value);
|
||||
|
||||
DBusMessage *
|
||||
dbus_call_raw(
|
||||
unsigned int timeout, /* in milliseconds */
|
||||
DBusMessage * request_ptr);
|
||||
|
||||
bool
|
||||
dbus_call(
|
||||
unsigned int timeout, /* in milliseconds */
|
||||
|
@ -106,8 +111,6 @@ dbus_unregister_service_lifetime_hook(
|
|||
DBusConnection * connection,
|
||||
const char * service);
|
||||
|
||||
#define DBUS_CALL_DEFAULT_TIMEOUT 3000 // in milliseconds
|
||||
|
||||
#include "method.h"
|
||||
#include "signal.h"
|
||||
#include "interface.h"
|
||||
|
|
|
@ -226,19 +226,10 @@ jack_proxy_read_conf_container(
|
|||
return false;
|
||||
}
|
||||
|
||||
// send message and get a handle for a reply
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
DBUS_CALL_DEFAULT_TIMEOUT,
|
||||
&g_dbus_error);
|
||||
|
||||
reply_ptr = dbus_call_raw(0, request_ptr);
|
||||
dbus_message_unref(request_ptr);
|
||||
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
log_error("no reply from JACK server, error is '%s'", g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -358,19 +349,10 @@ jack_proxy_get_parameter_value(
|
|||
return false;
|
||||
}
|
||||
|
||||
// send message and get a handle for a reply
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
DBUS_CALL_DEFAULT_TIMEOUT,
|
||||
&g_dbus_error);
|
||||
|
||||
reply_ptr = dbus_call_raw(0, request_ptr);
|
||||
dbus_message_unref(request_ptr);
|
||||
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
log_error("no reply from JACK server, error is '%s'", g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -476,19 +458,10 @@ jack_proxy_set_parameter_value(
|
|||
return false;
|
||||
}
|
||||
|
||||
// send message and get a handle for a reply
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
DBUS_CALL_DEFAULT_TIMEOUT,
|
||||
&g_dbus_error);
|
||||
|
||||
reply_ptr = dbus_call_raw(0, request_ptr);
|
||||
dbus_message_unref(request_ptr);
|
||||
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
log_error("no reply from JACK server, error is '%s'", g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -529,19 +502,10 @@ jack_proxy_reset_parameter_value(
|
|||
return false;
|
||||
}
|
||||
|
||||
// send message and get a handle for a reply
|
||||
reply_ptr = dbus_connection_send_with_reply_and_block(
|
||||
g_dbus_connection,
|
||||
request_ptr,
|
||||
DBUS_CALL_DEFAULT_TIMEOUT,
|
||||
&g_dbus_error);
|
||||
|
||||
reply_ptr = dbus_call_raw(0, request_ptr);
|
||||
dbus_message_unref(request_ptr);
|
||||
|
||||
if (reply_ptr == NULL)
|
||||
{
|
||||
log_error("no reply from JACK server, error is '%s'", g_dbus_error.message);
|
||||
dbus_error_free(&g_dbus_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue