On Thu, 2012-08-23 at 20:34 +0200, Toke Høiland-Jørgensen wrote:
> Ove Kåven <[email protected]> writes:
> 
> > Sure. In fact, in dbus 1.4.x (on Harmattan), giving INT_MAX results in
> > no timeout. This special value is just not defined in the headers.
> >
> > I see no such special case in dbus 1.2.x, but I suppose that timeout
> > will be long enough anyway.
> 
> Sorry for posting about this again, but I'm not sure what happened to
> this fix. Is it possible to acquire a build for Harmattan with it
> applied, or do I have to look into building it myself?

Right now you would have to build yourself. I just committed an untested
patch to the "for-master/dbus" branch. Patch attached.

> In the latter case, is there any reason why I can't just manually patch
> the source packages from http://people.debian.org/~ovek/harmattan/ and
> build from that? Or is there a better place to get the source (the
> Gitorious repository linked from the website is from before this
> thread)? :)

Ove's repo is what you need for Harmattan.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From a15e8be1c29d09d13a6f9f6e0bff3f9f886da42f Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Thu, 23 Aug 2012 13:57:29 +0200
Subject: [PATCH] local sync: fix timeout with local sync with libdbus
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using libdbus instead of GIO D-Bus (as done by syncevolution.org
binaries and SyncEvolution on Maemo), local sync may have aborted
after 25 seconds when syncing many items with a D-Bus timeout error:

[ERROR] sending message to child failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Reported by Toke Høiland-Jørgensen for Harmattan. Somehow not encountered
elsewhere.

Root cause is the use of the default D-Bus timeout of 25 seconds
instead of disabling the timeout altogether. Fixed by using
DBUS_TIMEOUT_INFINITE and INT_MAX as fallback.
---
 src/gdbus/gdbus-cxx-bridge.h |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gdbus/gdbus-cxx-bridge.h b/src/gdbus/gdbus-cxx-bridge.h
index b8426cf..61bba49 100644
--- a/src/gdbus/gdbus-cxx-bridge.h
+++ b/src/gdbus/gdbus-cxx-bridge.h
@@ -60,6 +60,14 @@
 #include "gdbus.h"
 #include "gdbus-cxx.h"
 
+// Not defined by 1.4.x in Maemo Harmattan; INT_MAX has the same
+// value and effect there. In older libdbus, it is the same as
+// a very long timeout (2147483s), which is good enough.
+#include <stdint.h>
+#ifndef DBUS_TIMEOUT_INFINITE
+# define DBUS_TIMEOUT_INFINITE INT_MAX
+#endif
+
 #include <map>
 #include <vector>
 #include <utility>
@@ -4213,7 +4221,7 @@ protected:
     void send(DBusMessagePtr &msg, const Callback_t &callback)
     {
         DBusPendingCall *call;
-        if (!dbus_connection_send_with_reply(m_conn.get(), msg.get(), &call, -1)) {
+        if (!dbus_connection_send_with_reply(m_conn.get(), msg.get(), &call, DBUS_TIMEOUT_INFINITE)) {
             throw std::runtime_error("dbus_connection_send failed");
         } else if (call == NULL) {
             throw std::runtime_error("received pending call is NULL");
@@ -4233,7 +4241,7 @@ protected:
         DBusErrorCXX error;
         // Constructor steals reference, reset() doesn't!
         // Therefore use constructor+copy instead of reset().
-        DBusMessagePtr reply = DBusMessagePtr(dbus_connection_send_with_reply_and_block(m_conn.get(), msg.get(), -1, &error));
+        DBusMessagePtr reply = DBusMessagePtr(dbus_connection_send_with_reply_and_block(m_conn.get(), msg.get(), DBUS_TIMEOUT_INFINITE, &error));
         if (!reply) {
             error.throwFailure(m_method);
         }
-- 
1.7.10.4

_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to