comparison src/bridge/bridge_constructor/dbus_frontend_template.py @ 1072:d123d61976c8

bridge (D-Bus): frontend side now use a 120 s timeout for async calls
author Goffi <goffi@goffi.org>
date Sun, 15 Jun 2014 00:18:28 +0200
parents 95758ef3faa8
children f094583732de
comparison
equal deleted inserted replaced
1071:eef1f200d733 1072:d123d61976c8
30 const_INT_PREFIX = "org.goffi.SAT" # Interface prefix 30 const_INT_PREFIX = "org.goffi.SAT" # Interface prefix
31 const_ERROR_PREFIX = const_INT_PREFIX + ".error" 31 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
32 const_OBJ_PATH = '/org/goffi/SAT/bridge' 32 const_OBJ_PATH = '/org/goffi/SAT/bridge'
33 const_CORE_SUFFIX = ".core" 33 const_CORE_SUFFIX = ".core"
34 const_PLUGIN_SUFFIX = ".plugin" 34 const_PLUGIN_SUFFIX = ".plugin"
35 const_TIMEOUT = 120
35 36
36 37
37 def dbus_to_bridge_exception(dbus_e): 38 def dbus_to_bridge_exception(dbus_e):
38 """Convert a DBusException to a BridgeException. 39 """Convert a DBusException to a BridgeException.
39 40
98 _callback = args.pop() 99 _callback = args.pop()
99 100
100 method = getattr(self.db_plugin_iface, name) 101 method = getattr(self.db_plugin_iface, name)
101 102
102 if async: 103 if async:
104 kwargs['timeout'] = const_TIMEOUT
103 kwargs['reply_handler'] = _callback 105 kwargs['reply_handler'] = _callback
104 kwargs['error_handler'] = lambda err: _errback(dbus_to_bridge_exception(err)) 106 kwargs['error_handler'] = lambda err: _errback(dbus_to_bridge_exception(err))
105 107
106 return method(*args, **kwargs) 108 return method(*args, **kwargs)
107 109