diff options
Diffstat (limited to 'src/object.cpp')
-rw-r--r-- | src/object.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/object.cpp b/src/object.cpp index f7d0916..88c3bb0 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -40,7 +40,7 @@ using namespace DBus; Object::Object(Connection &conn, const Path &path, const char *service) -: _conn(conn), _path(path), _service(service ? service : "") +: _conn(conn), _path(path), _service(service ? service : ""), _default_timeout(-1) { } @@ -48,6 +48,14 @@ Object::~Object() { } +void Object::set_timeout(int new_timeout) +{ + debug_log("%s: %d millies", __PRETTY_FUNCTION__, new_timeout); + if(new_timeout < 0 && new_timeout != -1) + throw ErrorInvalidArgs("Bad timeout, cannot set it"); + _default_timeout = new_timeout; +} + struct ObjectAdaptor::Private { static void unregister_function_stub(DBusConnection *, void *); @@ -329,7 +337,7 @@ Message ObjectProxy::_invoke_method(CallMessage &call) if (call.destination() == NULL) call.destination(service().c_str()); - return conn().send_blocking(call); + return conn().send_blocking(call, get_timeout()); } bool ObjectProxy::_invoke_method_noreply(CallMessage &call) |