bridge (D-Bus): frontend side now use a 120 s timeout for async calls

This commit is contained in:
Goffi 2014-06-15 00:18:28 +02:00
commit 8867ac6c60
2 changed files with 18 additions and 14 deletions

View file

@ -450,7 +450,7 @@ class DbusConstructor(Constructor):
completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
completion['async_args'] = 'callback=None, errback=None' if async else ''
completion['async_comma'] = ', ' if async and function['sig_in'] else ''
completion['async_args_result'] = 'reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))' if async else ''
completion['async_args_result'] = 'timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))' if async else ''
result = "self.db_%(category)s_iface.%(name)s(%(args_result)s%(async_comma)s%(async_args_result)s)" % completion
completion['result'] = ("unicode(%s)" if self.options.unicode and function['sig_out'] == 's' else "%s") % result
methods_part.append("""\

View file

@ -32,6 +32,7 @@ const_ERROR_PREFIX = const_INT_PREFIX + ".error"
const_OBJ_PATH = '/org/goffi/SAT/bridge'
const_CORE_SUFFIX = ".core"
const_PLUGIN_SUFFIX = ".plugin"
const_TIMEOUT = 120
def dbus_to_bridge_exception(dbus_e):
@ -100,6 +101,7 @@ class DBusBridgeFrontend(BridgeFrontend):
method = getattr(self.db_plugin_iface, name)
if async:
kwargs['timeout'] = const_TIMEOUT
kwargs['reply_handler'] = _callback
kwargs['error_handler'] = lambda err: _errback(dbus_to_bridge_exception(err))