SourceForge Patches ID: 2701443 - Add methods to adjust timeout. Submitted: Oron Peled ( oron ) - 2009-03-21 23:27:55 CET

This commit is contained in:
Andreas Volz 2010-06-03 20:44:32 +02:00
parent 7889c46e57
commit d083d07167
3 changed files with 25 additions and 4 deletions

View file

@ -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)