[tracker/tracker-0.10-alarm] miners/fs, tracker-extract: Use alarm() instead of GDBus' timeout
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10-alarm] miners/fs, tracker-extract: Use alarm() instead of GDBus' timeout
- Date: Tue, 13 Dec 2011 11:54:22 +0000 (UTC)
commit 71a1e822b7f48758a9351e91b524888e9d7fe428
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Dec 13 12:51:40 2011 +0100
miners/fs, tracker-extract: Use alarm() instead of GDBus' timeout
The alarm is reset after each document.
Fixes NB#282791.
src/miners/fs/tracker-miner-files.c | 2 +-
src/tracker-extract/tracker-controller.c | 3 +++
src/tracker-extract/tracker-main.c | 17 +++++++++++++++++
src/tracker-extract/tracker-main.h | 2 +-
4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index f3d19be..1c05825 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2192,7 +2192,7 @@ dbus_send_and_splice_async (GDBusConnection *connection,
g_dbus_connection_send_message_with_reply (connection,
message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
- -1,
+ G_MAXINT, /* timeout is enforced by an alarm() in tracker-extract */
NULL,
cancellable,
send_and_splice_dbus_callback,
diff --git a/src/tracker-extract/tracker-controller.c b/src/tracker-extract/tracker-controller.c
index 34b2b20..c04844d 100644
--- a/src/tracker-extract/tracker-controller.c
+++ b/src/tracker-extract/tracker-controller.c
@@ -335,6 +335,9 @@ reset_shutdown_timeout (TrackerController *controller)
TrackerControllerPrivate *priv;
GSource *source;
+ /* Reset alarm of the process too */
+ tracker_main_timeout_reset ();
+
priv = controller->priv;
if (priv->shutdown_timeout == 0) {
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index e115975..91cedb4 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -254,6 +254,20 @@ tracker_main_get_config (void)
return config;
}
+void
+tracker_main_timeout_reset (void)
+{
+#ifndef G_OS_WIN32
+ /* This replaces the default timeout of the gdbus call in miner-fs at
+ * dbus_send_and_splice_async (it puts control of the timeout in the hands
+ * of this process). In GDBus the default timeout when using -1 is
+ * 25*1000 msec (gdbusconnection.c at g_dbus_connection_send_message_
+ * with_reply_unlocked), so 25 seconds. */
+
+ alarm (25);
+#endif /* G_OS_WIN32 */
+}
+
static int
run_standalone (void)
{
@@ -436,6 +450,9 @@ main (int argc, char *argv[])
tracker_locale_init ();
tracker_albumart_init ();
+ /* Set initial alarm timeout */
+ tracker_main_timeout_reset ();
+
/* Main loop */
main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (main_loop);
diff --git a/src/tracker-extract/tracker-main.h b/src/tracker-extract/tracker-main.h
index 77d798e..9756d2e 100644
--- a/src/tracker-extract/tracker-main.h
+++ b/src/tracker-extract/tracker-main.h
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
/* This is used to not shutdown after the default of 30 seconds if we
* get more work to do.
*/
-void tracker_main_quit_timeout_reset (void);
+void tracker_main_timeout_reset (void);
/* Enables getting the config object from extractors */
TrackerConfig *tracker_main_get_config (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]