[Telepathy-commits] [telepathy-mission-control/master] Sleep for some time after a channel request
Alberto Mardegan
alberto.mardegan at nokia.com
Thu Mar 5 06:24:32 PST 2009
This hack is to workaround DBus reordering or messages: sometimes it happens
that the method return from Create/Ensure is delivered after the AddRequest
method call.
This sleep hopefully helps in reducing the chances this happens.
---
src/mcd-account-requests.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/mcd-account-requests.c b/src/mcd-account-requests.c
index 555280e..0afddf3 100644
--- a/src/mcd-account-requests.c
+++ b/src/mcd-account-requests.c
@@ -28,6 +28,8 @@
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include <config.h>
+#define __USE_BSD
+#include <unistd.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <libmcclient/mc-errors.h>
@@ -225,6 +227,26 @@ account_request_common (McdAccount *account, GHashTable *properties,
mc_svc_account_interface_channelrequests_return_from_create
(context, request_id);
+ /* FIXME: The following block of code is a hack to workaround D-Bus
+ * reordering the messages: bad things happen if the client gets the call
+ * to AddRequest or HandleChannels before the reply for the Create/Ensure
+ * call */
+ {
+ McdMaster *master;
+ TpDBusDaemon *dbus_daemon;
+ DBusConnection *connection;
+
+ master = mcd_master_get_default ();
+ dbus_daemon = mcd_master_get_dbus_daemon (master);
+ connection = dbus_g_connection_get_connection
+ (TP_PROXY (dbus_daemon)->dbus_connection);
+ dbus_connection_flush (connection);
+ dbus_connection_unref (connection);
+
+ DEBUG ("sleeping");
+ usleep (600000);
+ }
+
dispatcher = mcd_master_get_dispatcher (mcd_master_get_default ());
_mcd_dispatcher_add_request (dispatcher, account, channel);
}
--
1.5.6.5
More information about the telepathy-commits
mailing list